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
        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. 3
0
 internal SymbolConstructor(
     Engine engine,
     Realm realm,
     FunctionPrototype functionPrototype,
     ObjectPrototype objectPrototype)
     : base(engine, realm, _functionName, FunctionThisMode.Global)
 {
     _prototype           = functionPrototype;
     PrototypeObject      = new SymbolPrototype(engine, realm, this, objectPrototype);
     _length              = new PropertyDescriptor(JsNumber.PositiveZero, PropertyFlag.Configurable);
     _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden);
 }
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);
        }
Esempio n. 6
0
 internal SymbolInstance(Engine engine, SymbolPrototype prototype, JsSymbol symbol)
     : base(engine, ObjectClass.Symbol)
 {
     _prototype = prototype;
     SymbolData = symbol;
 }