当前位置: 首页>>代码示例>>C#>>正文


C# ScriptObject.GetParent方法代码示例

本文整理汇总了C#中Microsoft.JScript.ScriptObject.GetParent方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptObject.GetParent方法的具体用法?C# ScriptObject.GetParent怎么用?C# ScriptObject.GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.JScript.ScriptObject的用法示例。


在下文中一共展示了ScriptObject.GetParent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNameTo

 private void AddNameTo(ScriptObject enclosingScope)
 {
     while (enclosingScope is WithObject)
     {
         enclosingScope = enclosingScope.GetParent();
     }
     if (((IActivationObject) enclosingScope).GetLocalField(this.name) == null)
     {
         FieldInfo info;
         if (enclosingScope is ActivationObject)
         {
             if (enclosingScope is FunctionScope)
             {
                 info = ((ActivationObject) enclosingScope).AddNewField(this.name, null, FieldAttributes.Public);
             }
             else
             {
                 info = ((ActivationObject) enclosingScope).AddNewField(this.name, null, FieldAttributes.Static | FieldAttributes.Public);
             }
         }
         else
         {
             info = ((StackFrame) enclosingScope).AddNewField(this.name, null, FieldAttributes.Public);
         }
         JSLocalField field = info as JSLocalField;
         if (field != null)
         {
             field.debugOn = base.context.document.debugOn;
             field.isDefined = true;
         }
         this.field = (JSVariableField) info;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:FunctionExpression.cs

示例2: ScopeOfClassMemberInitializer

 static internal ClassScope ScopeOfClassMemberInitializer(ScriptObject scope) {
   while (scope != null) {
     if (scope is FunctionScope)
       return null;
     ClassScope cscope = scope as ClassScope;
     if (cscope != null)
       return cscope;
     scope = scope.GetParent();
   }
   return null;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:11,代码来源:classscope.cs

示例3: ScriptFunction

	// Constructors.
	protected ScriptFunction(ScriptObject parent, String name)
			: base(parent)
			{
				this.name = name;
				this.lengthValue = length;
				if(parent != null)
				{
					this.prototypeValue =
						new JSPrototypeObject(parent.GetParent(), this);
				}
				else
				{
					this.prototypeValue = Missing.Value;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:ScriptFunction.cs

示例4: AddNameTo

 void AddNameTo(ScriptObject enclosingScope){
   while (enclosingScope is WithObject) //Can only happen at run time and only if there is an eval
     enclosingScope = enclosingScope.GetParent();
   FieldInfo field = ((IActivationObject)enclosingScope).GetLocalField(this.name);
   if (field != null) return;
   if (enclosingScope is ActivationObject)
     if (enclosingScope is FunctionScope)
       field = ((ActivationObject)enclosingScope).AddNewField(this.name, null, FieldAttributes.Public);
     else
       field = ((ActivationObject)enclosingScope).AddNewField(this.name, null, FieldAttributes.Public|FieldAttributes.Static);
   else
     field = ((StackFrame)enclosingScope).AddNewField(this.name, null, FieldAttributes.Public);
   JSLocalField lfield = field as JSLocalField;
   if (lfield != null){
     // emit debug info for the local only if this block of code is in a section that has debug set
     lfield.debugOn = this.context.document.debugOn;
     lfield.isDefined = true;
   }
   this.field = (JSVariableField)field;
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:functionexpression.cs

示例5: IsAccessibleFrom

 internal bool IsAccessibleFrom(ScriptObject scope)
 {
     while ((scope != null) && !(scope is ClassScope))
     {
         scope = scope.GetParent();
     }
     ClassScope other = (ClassScope) this.cons.enclosing_scope;
     if (base.IsPrivate)
     {
         if (scope == null)
         {
             return false;
         }
         if (scope != other)
         {
             return ((ClassScope) scope).IsNestedIn(other, false);
         }
         return true;
     }
     if (base.IsFamily)
     {
         if (scope == null)
         {
             return false;
         }
         if (!((ClassScope) scope).IsSameOrDerivedFrom(other))
         {
             return ((ClassScope) scope).IsNestedIn(other, false);
         }
         return true;
     }
     if ((base.IsFamilyOrAssembly && (scope != null)) && (((ClassScope) scope).IsSameOrDerivedFrom(other) || ((ClassScope) scope).IsNestedIn(other, false)))
     {
         return true;
     }
     if (scope == null)
     {
         return (other.GetPackage() == null);
     }
     return (other.GetPackage() == ((ClassScope) scope).GetPackage());
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:41,代码来源:JSConstructor.cs

示例6: ScriptFunction

 internal ScriptFunction(ScriptObject parent, string name, int length) : base(parent)
 {
     this.ilength = length;
     this.name = name;
     this.proto = new JSPrototypeObject(parent.GetParent(), this);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:ScriptFunction.cs

示例7: IsAccessibleFrom

 internal bool IsAccessibleFrom(ScriptObject scope){ //Never call this if the member is public
   while (scope != null && !(scope is ClassScope))
     scope = scope.GetParent();
   ClassScope objType = null;
   if (this.obj is ClassScope)
     objType = (ClassScope)this.obj;
   else
     objType = (ClassScope)((ScriptObject)this.obj).GetParent();
   if (this.IsPrivate)
     if (scope == null)
       return false;
     else
       return scope == objType || ((ClassScope)scope).IsNestedIn(objType, this.IsStatic);
   else if (this.IsFamily)
     if (scope == null)
       return false;
     else
       return ((ClassScope)scope).IsSameOrDerivedFrom(objType) || ((ClassScope)scope).IsNestedIn(objType, this.IsStatic);
   else //if (this.IsAssembly)
     if (scope == null) //Code is not in a class and hence it is in the default package
       return objType.GetPackage() == null; //null indicates default package
     else
       return objType.GetPackage() == ((ClassScope)scope).GetPackage();
 }
开发者ID:ArildF,项目名称:masters,代码行数:24,代码来源:jsmemberfield.cs

示例8: IsAccessibleFrom

 internal bool IsAccessibleFrom(ScriptObject scope){ //Never call this if the member is public
   while (scope != null && !(scope is ClassScope))
     scope = scope.GetParent();
   ClassScope thisScope = (ClassScope)this.cons.enclosing_scope;
   if (this.IsPrivate)
     if (scope == null)
       return false;
     else
       return scope == thisScope || ((ClassScope)scope).IsNestedIn(thisScope, false);
   else if (this.IsFamily)
     if (scope == null)
       return false;
     else
       return ((ClassScope)scope).IsSameOrDerivedFrom(thisScope) || ((ClassScope)scope).IsNestedIn(thisScope, false);
   else { // if (this.IsAssembly || this.isFamilyOrAssembly)
     if (this.IsFamilyOrAssembly && scope != null &&
         (((ClassScope)scope).IsSameOrDerivedFrom(thisScope) || ((ClassScope)scope).IsNestedIn(thisScope, false)))
       return true;
     else if (scope == null) //Code is not in a class and hence it is in the default package
       return thisScope.GetPackage() == null; //null indicates default package
     else
       return thisScope.GetPackage() == ((ClassScope)scope).GetPackage();
   }
 }      
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:24,代码来源:jsconstructor.cs

示例9: InitPrototype

	// Initialize the prototype value from a subclass.
	internal void InitPrototype(ScriptObject parent)
			{
				this.prototypeValue =
					new JSPrototypeObject(parent.GetParent(), this);
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:6,代码来源:ScriptFunction.cs

示例10: InsideClassThatExtends

 private static bool InsideClassThatExtends(ScriptObject scope, Type type){
   while (scope is WithObject || scope is BlockScope)
     scope = scope.GetParent();
   if (scope is ClassScope)
     return type.IsAssignableFrom(((ClassScope)scope).GetBakedSuperType());
   if (scope is FunctionScope)
     return Binding.InsideClassThatExtends(((FunctionScope)scope).owner.enclosing_scope, type);
   //Eval does not see non public members, so don't worry about StackFrame
   return false;
 }
开发者ID:ArildF,项目名称:masters,代码行数:10,代码来源:binding.cs

示例11: ScriptFunction

 protected ScriptFunction(ScriptObject parent, String name)
   : base(parent, Typeob.ScriptFunction) {
   this.ilength = length;
   this.name = name;
   this.proto = new JSPrototypeObject(parent.GetParent(), this);
 }
开发者ID:ArildF,项目名称:masters,代码行数:6,代码来源:scriptfunction.cs

示例12: ScopeOfClassMemberInitializer

 internal static ClassScope ScopeOfClassMemberInitializer(ScriptObject scope)
 {
     while (scope != null)
     {
         if (scope is FunctionScope)
         {
             return null;
         }
         ClassScope scope2 = scope as ClassScope;
         if (scope2 != null)
         {
             return scope2;
         }
         scope = scope.GetParent();
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:ClassScope.cs


注:本文中的Microsoft.JScript.ScriptObject.GetParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。