Beispiel #1
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);
        }
Beispiel #2
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);
        }