예제 #1
0
        public static NumberPrototype CreatePrototypeObject(Engine engine, NumberConstructor numberConstructor)
        {
            var obj = new NumberPrototype(engine);
            obj.Prototype = engine.Object.PrototypeObject;
            obj.PrimitiveValue = 0;
            obj.Extensible = true;

            obj.FastAddProperty("constructor", numberConstructor, true, false, true);

            return obj;
        }
예제 #2
0
        public static NumberPrototype CreatePrototypeObject(Engine engine, NumberConstructor numberConstructor)
        {
            var obj = new NumberPrototype(engine);

            obj.Prototype      = engine.Object.PrototypeObject;
            obj.PrimitiveValue = 0;
            obj.Extensible     = true;

            obj.FastAddProperty("constructor", numberConstructor, true, false, true);

            return(obj);
        }
        public static NumberPrototype CreatePrototypeObject(Engine engine, NumberConstructor numberConstructor)
        {
            var obj = new NumberPrototype(engine)
            {
                _prototype         = engine.Object.PrototypeObject,
                NumberData         = JsNumber.Create(0),
                _numberConstructor = numberConstructor
            };


            return(obj);
        }
예제 #4
0
 internal NumberPrototype(
     Engine engine,
     Realm realm,
     NumberConstructor constructor,
     ObjectPrototype objectPrototype)
     : base(engine)
 {
     _prototype   = objectPrototype;
     NumberData   = JsNumber.Create(0);
     _realm       = realm;
     _constructor = constructor;
 }
예제 #5
0
        public static NumberPrototype CreatePrototypeObject(Engine engine, NumberConstructor numberConstructor)
        {
            var obj = new NumberPrototype(engine)
            {
                Prototype  = engine.Object.PrototypeObject,
                NumberData = JsNumber.Create(0),
                Extensible = true
            };

            obj.FastAddProperty("constructor", numberConstructor, true, false, true);

            return(obj);
        }
예제 #6
0
        public static NumberConstructor CreateNumberConstructor(Engine engine)
        {
            var obj = new NumberConstructor(engine);
            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Number constructor is the Function prototype object 
            obj.Prototype = engine.Function.PrototypeObject;
            obj.PrototypeObject = NumberPrototype.CreatePrototypeObject(engine, obj);

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

            // The initial value of Number.prototype is the Number prototype object
            obj.FastAddProperty("prototype", obj.PrototypeObject, false, false, false);

            return obj;
        }
예제 #7
0
        public static NumberConstructor CreateNumberConstructor(Engine engine)
        {
            var obj = new NumberConstructor(engine);

            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Number constructor is the Function prototype object
            obj.Prototype       = engine.Function.PrototypeObject;
            obj.PrototypeObject = NumberPrototype.CreatePrototypeObject(engine, obj);

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

            // The initial value of Number.prototype is the Number prototype object
            obj.FastAddProperty("prototype", obj.PrototypeObject, false, false, false);

            return(obj);
        }
예제 #8
0
        public static NumberConstructor CreateNumberConstructor(Engine engine)
        {
            var obj = new NumberConstructor(engine)
            {
                _prototype = engine.Function.PrototypeObject
            };

            // The value of the [[Prototype]] internal property of the Number constructor is the Function prototype object
            obj.PrototypeObject = NumberPrototype.CreatePrototypeObject(engine, obj);

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

            // The initial value of Number.prototype is the Number prototype object
            obj._prototypeDescriptor = new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden);

            return(obj);
        }
예제 #9
0
        public static NumberConstructor CreateNumberConstructor(Engine engine)
        {
            var obj = new NumberConstructor(engine);

            obj.Extensible = true;

            // The value of the [[Prototype]] internal property of the Number constructor is the Function prototype object
            obj.Prototype       = engine.Function.PrototypeObject;
            obj.PrototypeObject = NumberPrototype.CreatePrototypeObject(engine, obj);

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

            // The initial value of Number.prototype is the Number prototype object
            obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden));

            return(obj);
        }