コード例 #1
0
ファイル: MapConstructor.cs プロジェクト: rockyjvec/SpaceJS
        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);
        }
コード例 #2
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);
        }