Ejemplo n.º 1
0
        public static FunctionPrototype CreatePrototypeObject(Engine engine)
        {
            var obj = new FunctionPrototype(engine)
            {
                // The value of the [[Prototype]] internal property of the Function prototype object is the standard built-in Object prototype object
                _prototype = engine.Object.PrototypeObject,
                _length    = PropertyDescriptor.AllForbiddenDescriptor.NumberZero
            };

            return(obj);
        }
Ejemplo n.º 2
0
 internal FunctionConstructor(
     Engine engine,
     Realm realm,
     ObjectPrototype objectPrototype)
     : base(engine, realm, _functionName)
 {
     PrototypeObject      = new FunctionPrototype(engine, realm, objectPrototype);
     _prototype           = PrototypeObject;
     _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden);
     _length = new PropertyDescriptor(JsNumber.PositiveOne, PropertyFlag.Configurable);
 }
Ejemplo n.º 3
0
        public static FunctionPrototype CreatePrototypeObject(Engine engine)
        {
            var obj = new FunctionPrototype(engine);
            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Function prototype object is the standard built-in Object prototype object
            obj.Prototype = engine.Object.PrototypeObject;

            obj.FastAddProperty("length", 0, false, false, false);

            return obj;
        }
Ejemplo n.º 4
0
        public static FunctionPrototype CreatePrototypeObject(Engine engine)
        {
            var obj = new FunctionPrototype(engine);

            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Function prototype object is the standard built-in Object prototype object
            obj.Prototype = engine.Object.PrototypeObject;

            obj.SetOwnProperty("length", new PropertyDescriptor(0, PropertyFlag.AllForbidden));

            return(obj);
        }
Ejemplo n.º 5
0
        public static FunctionPrototype CreatePrototypeObject(Engine engine)
        {
            var obj = new FunctionPrototype(engine);

            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Function prototype object is the standard built-in Object prototype object
            obj.Prototype = engine.Object.PrototypeObject;

            obj.FastAddProperty("length", 0, false, false, false);

            return(obj);
        }
Ejemplo n.º 6
0
 public EvalFunctionInstance(
     Engine engine,
     Realm realm,
     FunctionPrototype functionPrototype)
     : base(
         engine,
         realm,
         _functionName,
         StrictModeScope.IsStrictModeCode ? FunctionThisMode.Strict : FunctionThisMode.Global)
 {
     _prototype = functionPrototype;
     _length    = new PropertyDescriptor(JsNumber.PositiveOne, PropertyFlag.Configurable);
 }
Ejemplo n.º 7
0
        public static FunctionConstructor CreateFunctionConstructor(Engine engine)
        {
            var obj = new FunctionConstructor(engine)
            {
                PrototypeObject = FunctionPrototype.CreatePrototypeObject(engine)
            };

            // The initial value of Function.prototype is the standard built-in Function prototype object

            // The value of the [[Prototype]] internal property of the Function constructor is the standard built-in Function prototype object
            obj._prototype = obj.PrototypeObject;

            obj._prototypeDescriptor = new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden);
            obj._length = new PropertyDescriptor(JsNumber.One, PropertyFlag.Configurable);

            return(obj);
        }
Ejemplo n.º 8
0
        public static FunctionConstructor CreateFunctionConstructor(Engine engine)
        {
            var obj = new FunctionConstructor(engine);

            obj.Extensible = true;

            // The initial value of Function.prototype is the standard built-in Function prototype object
            obj.PrototypeObject = FunctionPrototype.CreatePrototypeObject(engine);

            // The value of the [[Prototype]] internal property of the Function constructor is the standard built-in Function prototype object
            obj.Prototype = obj.PrototypeObject;

            obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden));
            obj.SetOwnProperty("length", new PropertyDescriptor(1, PropertyFlag.AllForbidden));

            return(obj);
        }
Ejemplo n.º 9
0
        public static FunctionConstructor CreateFunctionConstructor(Engine engine)
        {
            var obj = new FunctionConstructor(engine);

            obj.Extensible = true;

            // The initial value of Function.prototype is the standard built-in Function prototype object
            obj.PrototypeObject = FunctionPrototype.CreatePrototypeObject(engine);

            // The value of the [[Prototype]] internal property of the Function constructor is the standard built-in Function prototype object
            obj.Prototype = obj.PrototypeObject;

            obj.FastAddProperty("prototype", obj.PrototypeObject, false, false, false);

            obj.FastAddProperty("length", 1, false, false, false);

            return(obj);
        }