Ejemplo n.º 1
0
 internal MapPrototype(
     Engine engine,
     Realm realm,
     MapConstructor mapConstructor,
     ObjectPrototype objectPrototype) : base(engine, realm)
 {
     _prototype      = objectPrototype;
     _mapConstructor = mapConstructor;
 }
Ejemplo n.º 2
0
        public static MapPrototype CreatePrototypeObject(Engine engine, MapConstructor mapConstructor)
        {
            var obj = new MapPrototype(engine)
            {
                _prototype      = engine.Object.PrototypeObject,
                _mapConstructor = mapConstructor
            };

            return(obj);
        }
Ejemplo n.º 3
0
        private static MapConstructor CreateMapConstructorTemplate(Engine engine, string name)
        {
            var mapConstructor = new MapConstructor(engine, name);

            mapConstructor.Extensible = true;

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

            mapConstructor.SetOwnProperty("length", new PropertyDescriptor(0, PropertyFlag.Configurable));
            return(mapConstructor);
        }
Ejemplo n.º 4
0
        public static MapPrototype CreatePrototypeObject(Engine engine, MapConstructor mapConstructor)
        {
            var obj = new MapPrototype(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);
        }
Ejemplo n.º 5
0
        public static MapConstructor CreateMapConstructor(Engine engine)
        {
            var obj = new MapConstructor(engine)
            {
                _prototype = engine.Function.PrototypeObject
            };

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

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

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

            return(obj);
        }