示例#1
0
        public static IteratorPrototype CreatePrototypeObject(Engine engine, IteratorConstructor iteratorConstructor)
        {
            var obj = new IteratorPrototype(engine)
            {
                Extensible = true, Prototype = engine.Object.PrototypeObject
            };

            obj.SetOwnProperty("name", new PropertyDescriptor("Map", PropertyFlag.Configurable));

            return(obj);
        }
        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);
        }
示例#3
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);
        }
        public static IteratorPrototype CreatePrototypeObject(Engine engine, string name, IteratorConstructor iteratorConstructor)
        {
            var obj = new IteratorPrototype(engine)
            {
                _prototype = engine.Object.PrototypeObject,
                _name      = name
            };

            return(obj);
        }