Esempio n. 1
0
        public static SymbolPrototype CreatePrototypeObject(Engine engine, SymbolConstructor symbolConstructor)
        {
            var obj = new SymbolPrototype(engine)
            {
                _prototype         = engine.Object.PrototypeObject,
                _symbolConstructor = symbolConstructor
            };

            return(obj);
        }
Esempio n. 2
0
 internal SymbolPrototype(
     Engine engine,
     Realm realm,
     SymbolConstructor symbolConstructor,
     ObjectPrototype objectPrototype)
     : base(engine, realm)
 {
     _prototype   = objectPrototype;
     _constructor = symbolConstructor;
 }
Esempio n. 3
0
        public static SymbolPrototype CreatePrototypeObject(Engine engine, SymbolConstructor symbolConstructor)
        {
            var obj = new SymbolPrototype(engine);

            obj.Prototype  = engine.Object.PrototypeObject;
            obj.Extensible = true;
            obj.SetOwnProperty("length", new PropertyDescriptor(0, PropertyFlag.AllForbidden));
            obj.FastAddProperty("constructor", symbolConstructor, true, false, true);

            return(obj);
        }
Esempio n. 4
0
        public static SymbolConstructor CreateSymbolConstructor(Engine engine)
        {
            var obj = new SymbolConstructor(engine)
            {
                _prototype = engine.Function.PrototypeObject
            };

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

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

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

            return(obj);
        }
Esempio n. 5
0
        public static SymbolConstructor CreateSymbolConstructor(Engine engine)
        {
            var obj = new SymbolConstructor(engine);

            obj.Extensible = true;

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

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

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


            obj.SetOwnProperty("species", new PropertyDescriptor(GlobalSymbolRegistry.Species, PropertyFlag.AllForbidden));

            return(obj);
        }