ToIReflect() static private method

static private ToIReflect ( Type t, VsaEngine engine ) : IReflect
t System.Type
engine Microsoft.JScript.Vsa.VsaEngine
return IReflect
 private IReflect ProvideWrapperForPrototypeProperties(IReflect obType)
 {
     //Provide for early binding to prototype methods in fast mode, by fudging the type
     if (obType == Typeob.String)
     {
         obType = Globals.globalObject.originalString.Construct();
         ((JSObject)obType).noExpando = this.fast;
         this.isImplicitWrapper       = true;
     }
     else if ((obType is Type && Typeob.Array.IsAssignableFrom((Type)obType)) || obType is TypedArray)
     {
         obType = Globals.globalObject.originalArray.ConstructWrapper();
         ((JSObject)obType).noExpando = this.fast;
         this.isImplicitWrapper       = true;
     }
     else if (obType == Typeob.Boolean)
     {
         obType = Globals.globalObject.originalBoolean.Construct();
         ((JSObject)obType).noExpando = this.fast;
         this.isImplicitWrapper       = true;
     }
     else if (Convert.IsPrimitiveNumericType(obType))
     {
         Type baseType = (Type)obType;
         obType = Globals.globalObject.originalNumber.Construct();
         ((JSObject)obType).noExpando    = this.fast;
         ((NumberObject)obType).baseType = baseType;
         this.isImplicitWrapper          = true;
     }
     else if (obType is Type)
     {
         obType = Convert.ToIReflect((Type)obType, this.Engine);
     }
     return(obType);
 }
Beispiel #2
0
        internal IReflect ToIReflect()
        {
            if (!(this.expression is ConstantWrapper))
            {
                this.PartiallyEvaluate();
            }
            IReflect result = this.cachedIR;

            if (result != null)
            {
                return(result);
            }
            Object value = this.expression.Evaluate();

            if (value is ClassScope || value is TypedArray || this.context == null)
            {
                result = (IReflect)value;
            }
            else
            {
                result = Convert.ToIReflect((Type)value, this.Engine);
            }
            if (this.isArray)
            {
                return(this.cachedIR = new TypedArray(result, this.rank));
            }
            else
            {
                return(this.cachedIR = result);
            }
        }