internal void ReRun(GlobalScope scope) { if (this.field is JSGlobalField) { ((JSGlobalField)this.field).ILField = scope.GetField(this.name, BindingFlags.Public | BindingFlags.Static); this.field.SetValue(scope, this.GetObject()); this.field = null; } }
internal override WrappedNamespace EvaluateAsWrappedNamespace(bool giveErrorIfNameInUse) { Namespace ns = Namespace.GetNamespace(this.name, this.Engine); GlobalScope scope = ((IActivationObject)Globals.ScopeStack.Peek()).GetGlobalScope(); FieldInfo field = giveErrorIfNameInUse ? scope.GetLocalField(this.name) : scope.GetField(this.name, BindingFlags.Public | BindingFlags.Static); if (field != null) { if (giveErrorIfNameInUse && (!field.IsLiteral || !(field.GetValue(null) is Namespace))) { this.context.HandleError(JSError.DuplicateName, true); } } else { field = scope.AddNewField(this.name, ns, FieldAttributes.Literal | FieldAttributes.Public); ((JSVariableField)field).type = new TypeExpression(new ConstantWrapper(Typeob.Namespace, this.context)); ((JSVariableField)field).originalContext = this.context; } return(new WrappedNamespace(this.name, this.Engine)); }
internal void ReRun(GlobalScope scope) { if (this.field is JSGlobalField) { ((JSGlobalField) this.field).ILField = scope.GetField(base.name, BindingFlags.Public | BindingFlags.Static); this.field.SetValue(scope, this.GetObject()); this.field = null; } }
internal override WrappedNamespace EvaluateAsWrappedNamespace(bool giveErrorIfNameInUse) { Namespace namespace2 = Namespace.GetNamespace(base.name, base.Engine); GlobalScope globalScope = ((IActivationObject)base.Globals.ScopeStack.Peek()).GetGlobalScope(); FieldInfo info = giveErrorIfNameInUse ? globalScope.GetLocalField(base.name) : globalScope.GetField(base.name, BindingFlags.Public | BindingFlags.Static); if (info != null) { if (giveErrorIfNameInUse && (!info.IsLiteral || !(info.GetValue(null) is Namespace))) { base.context.HandleError(JSError.DuplicateName, true); } } else { info = globalScope.AddNewField(base.name, namespace2, FieldAttributes.Literal | FieldAttributes.Public); ((JSVariableField)info).type = new TypeExpression(new ConstantWrapper(Typeob.Namespace, base.context)); ((JSVariableField)info).originalContext = base.context; } return(new WrappedNamespace(base.name, base.Engine)); }