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