public static SetPrototype CreatePrototypeObject(Engine engine, SetConstructor mapConstructor)
        {
            var obj = new SetPrototype(engine)
            {
                _prototype      = engine.Object.PrototypeObject,
                _mapConstructor = mapConstructor
            };

            return(obj);
        }
Esempio n. 2
0
 internal SetConstructor(
     Engine engine,
     Realm realm,
     FunctionPrototype functionPrototype,
     ObjectPrototype objectPrototype)
     : base(engine, realm, _functionName, FunctionThisMode.Global)
 {
     _prototype           = functionPrototype;
     PrototypeObject      = new SetPrototype(engine, realm, this, objectPrototype);
     _length              = new PropertyDescriptor(0, PropertyFlag.Configurable);
     _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden);
 }
Esempio n. 3
0
        public static SetConstructor CreateSetConstructorTemplate(string name, Engine engine)
        {
            var ctr = new SetConstructor(engine, name);

            ctr.Extensible = true;

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

            ctr.SetOwnProperty("length", new PropertyDescriptor(0, PropertyFlag.Configurable));
            return(ctr);
        }
Esempio n. 4
0
        public static SetPrototype CreatePrototypeObject(Engine engine, SetConstructor mapConstructor)
        {
            var obj = new SetPrototype(engine)
            {
                Extensible = true,
                Prototype  = engine.Object.PrototypeObject
            };

            obj.SetOwnProperty("length", new PropertyDescriptor(0, PropertyFlag.Configurable));
            obj.SetOwnProperty("constructor", new PropertyDescriptor(mapConstructor, PropertyFlag.NonEnumerable));

            return(obj);
        }
Esempio n. 5
0
        public static SetConstructor CreateSetConstructor(Engine engine)
        {
            var obj = new SetConstructor(engine)
            {
                _prototype = engine.Function.PrototypeObject
            };

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

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

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

            return(obj);
        }