Inheritance: ScriptObject, IActivationObject
コード例 #1
0
        internal override AST PartiallyEvaluate()
        {
            this.obj = this.obj.PartiallyEvaluate();
            WithObject wob;

            if (this.obj is ConstantWrapper)
            {
                Object ob = Convert.ToObject(this.obj.Evaluate(), this.Engine);
                wob = new WithObject(Globals.ScopeStack.Peek(), ob);
                if (ob is JSObject && ((JSObject)ob).noExpando)
                {
                    wob.isKnownAtCompileTime = true;
                }
            }
            else
            {
                wob = new WithObject(Globals.ScopeStack.Peek(), new JSObject(null, false));
            }
            Globals.ScopeStack.Push(wob);
            try{
                this.block = this.block.PartiallyEvaluate();
            }finally{
                Globals.ScopeStack.Pop();
            }
            return(this);
        }
コード例 #2
0
        internal override AST PartiallyEvaluate()
        {
            WithObject obj2;

            this.obj = this.obj.PartiallyEvaluate();
            if (this.obj is ConstantWrapper)
            {
                object obj3 = Microsoft.JScript.Convert.ToObject(this.obj.Evaluate(), base.Engine);
                obj2 = new WithObject(base.Globals.ScopeStack.Peek(), obj3);
                if ((obj3 is JSObject) && ((JSObject)obj3).noExpando)
                {
                    obj2.isKnownAtCompileTime = true;
                }
            }
            else
            {
                obj2 = new WithObject(base.Globals.ScopeStack.Peek(), new JSObject(null, false));
            }
            base.Globals.ScopeStack.Push(obj2);
            try
            {
                this.block = this.block.PartiallyEvaluate();
            }
            finally
            {
                base.Globals.ScopeStack.Pop();
            }
            return(this);
        }
コード例 #3
0
        public static void PushStackFrameForMethod(object thisob, JSLocalField[] fields, VsaEngine engine)
        {
            Globals           globals = engine.Globals;
            IActivationObject obj2    = (IActivationObject)globals.ScopeStack.Peek();
            string            name    = thisob.GetType().Namespace;
            WithObject        parent  = null;

            if ((name != null) && (name.Length > 0))
            {
                parent = new WithObject(obj2.GetGlobalScope(), new WrappedNamespace(name, engine))
                {
                    isKnownAtCompileTime = true
                };
                parent = new WithObject(parent, thisob);
            }
            else
            {
                parent = new WithObject(obj2.GetGlobalScope(), thisob);
            }
            parent.isKnownAtCompileTime = true;
            Microsoft.JScript.StackFrame item = new Microsoft.JScript.StackFrame(parent, fields, new object[fields.Length], thisob)
            {
                closureInstance = thisob
            };
            globals.ScopeStack.GuardedPush(item);
        }
コード例 #4
0
        internal void SetWithValue(WithObject scope, object value)
        {
            FieldInfo field = scope.GetField(base.name, this.lexLevel);

            if (field != null)
            {
                field.SetValue(scope, value);
            }
        }
コード例 #5
0
ファイル: lookup.cs プロジェクト: blancosj/dodonet-framework
        internal void SetWithValue(WithObject scope, Object value)
        {
            Debug.Assert(!this.isFullyResolved);
            FieldInfo withField = scope.GetField(this.name, this.lexLevel);

            if (withField != null)
            {
                withField.SetValue(scope, value);
                return;
            }
        }
コード例 #6
0
 internal override AST PartiallyEvaluate(){
   this.obj = this.obj.PartiallyEvaluate();
   WithObject wob;
   if (this.obj is ConstantWrapper){
     Object ob = Convert.ToObject(this.obj.Evaluate(), this.Engine);          
     wob = new WithObject(Globals.ScopeStack.Peek(), ob);
     if (ob is JSObject && ((JSObject)ob).noExpando)
       wob.isKnownAtCompileTime = true;
   }else
     wob = new WithObject(Globals.ScopeStack.Peek(), new JSObject(null, false));
   Globals.ScopeStack.Push(wob);
   try{
     this.block = this.block.PartiallyEvaluate();
   }finally{
     Globals.ScopeStack.Pop();
   }
   return this;
 }
コード例 #7
0
ファイル: stackframe.cs プロジェクト: ydunk/masters
        public static void PushStackFrameForMethod(Object thisob, JSLocalField[] fields, VsaEngine engine)
        {
            Globals           globals          = engine.Globals;
            IActivationObject top              = (IActivationObject)globals.ScopeStack.Peek();
            String            currentNamespace = thisob.GetType().Namespace;
            WithObject        wob              = null;

            if (currentNamespace != null && currentNamespace.Length > 0)
            {
                wob = new WithObject(top.GetGlobalScope(), new WrappedNamespace(currentNamespace, engine));
                wob.isKnownAtCompileTime = true; //For use by an eval inside this method
                wob = new WithObject(wob, thisob);
            }
            else
            {
                wob = new WithObject(top.GetGlobalScope(), thisob);
            }
            wob.isKnownAtCompileTime = true;
            StackFrame sf = new StackFrame(wob, fields, new Object[fields.Length], thisob);

            sf.closureInstance = thisob;
            globals.ScopeStack.GuardedPush(sf);
        }
コード例 #8
0
ファイル: lookup.cs プロジェクト: blancosj/dodonet-framework
        private void BindName()
        {
            int          lexLevel         = 0;
            int          evalLexLevel     = 0;
            ScriptObject scope            = Globals.ScopeStack.Peek();
            BindingFlags flags            = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            bool         staticClassFound = false;                  // is there a static class on the scope chain
            bool         enclosingClassForStaticClassFound = false; // has the class enclosing a static nested class been found

            while (scope != null)
            {
                MemberInfo[] members   = null;
                WithObject   withScope = scope as WithObject;
                if (withScope != null && enclosingClassForStaticClassFound)
                {
                    members = withScope.GetMember(this.name, flags, false);
                }
                else
                {
                    members = scope.GetMember(this.name, flags);
                }
                this.members = members;
                if (members.Length > 0)
                {
                    break;
                }
                if (scope is WithObject)
                {
                    this.isFullyResolved = this.isFullyResolved && ((WithObject)scope).isKnownAtCompileTime;
                    lexLevel++;
                }
                else if (scope is ActivationObject)
                {
                    this.isFullyResolved = this.isFullyResolved && ((ActivationObject)scope).isKnownAtCompileTime;
                    if (scope is BlockScope || (scope is FunctionScope && ((FunctionScope)scope).mustSaveStackLocals))
                    {
                        lexLevel++;
                    }
                    if (scope is ClassScope)
                    {
                        if (staticClassFound)
                        {
                            enclosingClassForStaticClassFound = true;
                        }
                        if (((ClassScope)scope).owner.isStatic)
                        {
                            flags           &= ~BindingFlags.Instance;
                            staticClassFound = true;
                        }
                    }
                }
                else if (scope is StackFrame)
                {
                    lexLevel++;
                }
                evalLexLevel++;
                scope = scope.GetParent();
            }
            if (this.members.Length > 0)
            {
                this.lexLevel     = lexLevel;
                this.evalLexLevel = evalLexLevel;
            }
        }
コード例 #9
0
 public static void PushStackFrameForMethod(Object thisob, JSLocalField[] fields, VsaEngine engine){
   Globals globals = engine.Globals;
   IActivationObject top = (IActivationObject)globals.ScopeStack.Peek();
   String currentNamespace = thisob.GetType().Namespace;
   WithObject wob = null;
   if (currentNamespace != null && currentNamespace.Length > 0){
     wob = new WithObject(top.GetGlobalScope(), new WrappedNamespace(currentNamespace, engine));
     wob.isKnownAtCompileTime = true; //For use by an eval inside this method
     wob = new WithObject(wob, thisob);
   }else
     wob = new WithObject(top.GetGlobalScope(), thisob);
   wob.isKnownAtCompileTime = true; 
   StackFrame sf = new StackFrame(wob, fields, new Object[fields.Length], thisob);
   sf.closureInstance = thisob;
   globals.ScopeStack.GuardedPush(sf);
 }
コード例 #10
0
ファイル: lookup.cs プロジェクト: ArildF/masters
 internal void SetWithValue(WithObject scope, Object value){
   Debug.Assert(!this.isFullyResolved);
   FieldInfo withField = scope.GetField(this.name, this.lexLevel);
   if (withField != null){
     withField.SetValue(scope, value);
     return;
   }
 }
コード例 #11
0
 internal override AST PartiallyEvaluate()
 {
     WithObject obj2;
     this.obj = this.obj.PartiallyEvaluate();
     if (this.obj is ConstantWrapper)
     {
         object obj3 = Microsoft.JScript.Convert.ToObject(this.obj.Evaluate(), base.Engine);
         obj2 = new WithObject(base.Globals.ScopeStack.Peek(), obj3);
         if ((obj3 is JSObject) && ((JSObject) obj3).noExpando)
         {
             obj2.isKnownAtCompileTime = true;
         }
     }
     else
     {
         obj2 = new WithObject(base.Globals.ScopeStack.Peek(), new JSObject(null, false));
     }
     base.Globals.ScopeStack.Push(obj2);
     try
     {
         this.block = this.block.PartiallyEvaluate();
     }
     finally
     {
         base.Globals.ScopeStack.Pop();
     }
     return this;
 }
コード例 #12
0
 public static void PushStackFrameForMethod(object thisob, JSLocalField[] fields, VsaEngine engine)
 {
     Globals globals = engine.Globals;
     IActivationObject obj2 = (IActivationObject) globals.ScopeStack.Peek();
     string name = thisob.GetType().Namespace;
     WithObject parent = null;
     if ((name != null) && (name.Length > 0))
     {
         parent = new WithObject(obj2.GetGlobalScope(), new WrappedNamespace(name, engine)) {
             isKnownAtCompileTime = true
         };
         parent = new WithObject(parent, thisob);
     }
     else
     {
         parent = new WithObject(obj2.GetGlobalScope(), thisob);
     }
     parent.isKnownAtCompileTime = true;
     Microsoft.JScript.StackFrame item = new Microsoft.JScript.StackFrame(parent, fields, new object[fields.Length], thisob) {
         closureInstance = thisob
     };
     globals.ScopeStack.GuardedPush(item);
 }
コード例 #13
0
        private void BindName()
        {
            int          num         = 0;
            int          num2        = 0;
            ScriptObject parent      = base.Globals.ScopeStack.Peek();
            BindingFlags bindingAttr = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
            bool         flag        = false;
            bool         flag2       = false;

            while (parent != null)
            {
                MemberInfo[] member = null;
                WithObject   obj3   = parent as WithObject;
                if ((obj3 != null) && flag2)
                {
                    member = obj3.GetMember(base.name, bindingAttr, false);
                }
                else
                {
                    member = parent.GetMember(base.name, bindingAttr);
                }
                base.members = member;
                if (member.Length > 0)
                {
                    break;
                }
                if (parent is WithObject)
                {
                    base.isFullyResolved = base.isFullyResolved && ((WithObject)parent).isKnownAtCompileTime;
                    num++;
                }
                else if (parent is ActivationObject)
                {
                    base.isFullyResolved = base.isFullyResolved && ((ActivationObject)parent).isKnownAtCompileTime;
                    if ((parent is BlockScope) || ((parent is FunctionScope) && ((FunctionScope)parent).mustSaveStackLocals))
                    {
                        num++;
                    }
                    if (parent is ClassScope)
                    {
                        if (flag)
                        {
                            flag2 = true;
                        }
                        if (((ClassScope)parent).owner.isStatic)
                        {
                            bindingAttr &= ~BindingFlags.Instance;
                            flag         = true;
                        }
                    }
                }
                else if (parent is StackFrame)
                {
                    num++;
                }
                num2++;
                parent = parent.GetParent();
            }
            if (base.members.Length > 0)
            {
                this.lexLevel     = num;
                this.evalLexLevel = num2;
            }
        }