Example #1
0
        public static MapPrototype CreatePrototypeObject(Engine engine, MapConstructor mapConstructor)
        {
            var obj = new MapPrototype(engine)
            {
                _prototype      = engine.Object.PrototypeObject,
                _mapConstructor = mapConstructor
            };

            return(obj);
        }
Example #2
0
 internal MapConstructor(
     Engine engine,
     Realm realm,
     FunctionPrototype functionPrototype,
     ObjectPrototype objectPrototype)
     : base(engine, realm, _functionName)
 {
     _prototype           = functionPrototype;
     PrototypeObject      = new MapPrototype(engine, realm, this, objectPrototype);
     _length              = new PropertyDescriptor(0, PropertyFlag.Configurable);
     _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden);
 }
Example #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);
        }
Example #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);
        }
        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);
        }