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); }
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); }