public static IteratorConstructor CreateIteratorConstructor(Engine engine)
        {
            var obj = new IteratorConstructor(engine);

            obj.ArrayIteratorPrototypeObject        = IteratorPrototype.CreatePrototypeObject(engine, "Array Iterator", obj);
            obj.GenericIteratorPrototypeObject      = IteratorPrototype.CreatePrototypeObject(engine, null, obj);
            obj.MapIteratorPrototypeObject          = IteratorPrototype.CreatePrototypeObject(engine, "Map Iterator", obj);
            obj.RegExpStringIteratorPrototypeObject = IteratorPrototype.CreatePrototypeObject(engine, "RegExp String Iterator", obj);
            obj.SetIteratorPrototypeObject          = IteratorPrototype.CreatePrototypeObject(engine, "Set Iterator", obj);
            obj.StringIteratorPrototypeObject       = IteratorPrototype.CreatePrototypeObject(engine, "String Iterator", obj);
            return(obj);
        }
Пример #2
0
        public static IteratorConstructor CreateIteratorConstructor(Engine engine)
        {
            var obj = new IteratorConstructor(engine);

            obj.Extensible = true;

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

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

            // The initial value of Map.prototype is the Map prototype object
            obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden));

            return(obj);
        }