本文整理汇总了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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}
示例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);
}
示例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();
}
示例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();
}
}
示例9: InitPrototype
// Initialize the prototype value from a subclass.
internal void InitPrototype(ScriptObject parent)
{
this.prototypeValue =
new JSPrototypeObject(parent.GetParent(), this);
}
示例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;
}
示例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);
}
示例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;
}