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

            return(obj);
        }
示例#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);
        }
示例#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);
 }
示例#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);
        }
示例#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);
        }
示例#6
0
 internal SymbolInstance(Engine engine, SymbolPrototype prototype, JsSymbol symbol)
     : base(engine, ObjectClass.Symbol)
 {
     _prototype = prototype;
     SymbolData = symbol;
 }