public static StringConstructor CreateStringConstructor(Engine engine) { var obj = new StringConstructor(engine); obj.Extensible = true; // The value of the [[Prototype]] internal property of the String constructor is the Function prototype object obj.Prototype = engine.Function.PrototypeObject; obj.PrototypeObject = StringPrototype.CreatePrototypeObject(engine, obj); obj.FastAddProperty("length", 1, false, false, false); // The initial value of String.prototype is the String prototype object obj.FastAddProperty("prototype", obj.PrototypeObject, false, false, false); return(obj); }
public static StringConstructor CreateStringConstructor(Engine engine) { var obj = new StringConstructor(engine); obj.Extensible = true; // The value of the [[Prototype]] internal property of the String constructor is the Function prototype object obj.Prototype = engine.Function.PrototypeObject; obj.PrototypeObject = StringPrototype.CreatePrototypeObject(engine, obj); obj.SetOwnProperty("length", new PropertyDescriptor(1, PropertyFlag.AllForbidden)); // The initial value of String.prototype is the String prototype object obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden)); return(obj); }
public static StringConstructor CreateStringConstructor(Engine engine) { var obj = new StringConstructor(engine) { _prototype = engine.Function.PrototypeObject }; // The value of the [[Prototype]] internal property of the String constructor is the Function prototype object obj.PrototypeObject = StringPrototype.CreatePrototypeObject(engine, obj); obj._length = new PropertyDescriptor(JsNumber.One, PropertyFlag.Configurable); // The initial value of String.prototype is the String prototype object obj._prototypeDescriptor = new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden); return(obj); }