Пример #1
0
        public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo locale)
        {
            if (this.type != null)
            {
                value = Convert.Coerce(value, this.type);
            }
            while (obj is BlockScope)
            {
                obj = ((BlockScope)obj).GetParent();
            }
            StackFrame   sf   = (StackFrame)obj;
            JSLocalField f    = this.outerField;
            int          slot = this.slotNumber;

            while (f != null)
            {
                slot = f.slotNumber;
                sf   = (StackFrame)sf.GetParent();
                f    = f.outerField;
            }
            if (sf.localVars == null)
            {
                return;                   //happens when assigning to a constant from latebound code
            }
            sf.localVars[slot] = value;
        }
Пример #2
0
        public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo locale)
        {
            if (base.type != null)
            {
                value = Microsoft.JScript.Convert.Coerce(value, base.type);
            }
            while (obj is BlockScope)
            {
                obj = ((BlockScope)obj).GetParent();
            }
            StackFrame   parent     = (StackFrame)obj;
            JSLocalField outerField = this.outerField;
            int          slotNumber = this.slotNumber;

            while (outerField != null)
            {
                slotNumber = outerField.slotNumber;
                parent     = (StackFrame)parent.GetParent();
                outerField = outerField.outerField;
            }
            if (parent.localVars != null)
            {
                parent.localVars[slotNumber] = value;
            }
        }
Пример #3
0
 public override object GetValue(object obj)
 {
     if (((base.attributeFlags & FieldAttributes.Literal) == FieldAttributes.PrivateScope) || (base.value is FunctionObject))
     {
         while (obj is BlockScope)
         {
             obj = ((BlockScope)obj).GetParent();
         }
         StackFrame   parent     = (StackFrame)obj;
         JSLocalField outerField = this.outerField;
         int          slotNumber = this.slotNumber;
         while (outerField != null)
         {
             slotNumber = outerField.slotNumber;
             parent     = (StackFrame)parent.GetParent();
             outerField = outerField.outerField;
         }
         return(parent.localVars[slotNumber]);
     }
     return(base.value);
 }
Пример #4
0
 public override Object GetValue(Object obj)
 {
     if ((this.attributeFlags & FieldAttributes.Literal) != (FieldAttributes)0 && !(this.value is FunctionObject))
     {
         return(this.value);
     }
     else
     {
         while (obj is BlockScope)
         {
             obj = ((BlockScope)obj).GetParent();
         }
         StackFrame   sf   = (StackFrame)obj;
         JSLocalField f    = this.outerField;
         int          slot = this.slotNumber;
         while (f != null)
         {
             slot = f.slotNumber;
             sf   = (StackFrame)sf.GetParent();
             f    = f.outerField;
         }
         return(sf.localVars[slot]);
     }
 }