internal ErrorConstructor( Engine engine, Realm realm, ObjectInstance functionPrototype, ObjectInstance objectPrototype, JsString name, Func <Intrinsics, ObjectInstance> intrinsicDefaultProto) : base(engine, realm, name) { _intrinsicDefaultProto = intrinsicDefaultProto; _prototype = functionPrototype; PrototypeObject = new ErrorPrototype(engine, realm, this, objectPrototype, name, ObjectClass.Object); _length = new PropertyDescriptor(JsNumber.PositiveOne, PropertyFlag.Configurable); _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden); }
public static ErrorPrototype CreatePrototypeObject(Engine engine, ErrorConstructor errorConstructor, string name) { var obj = new ErrorPrototype(engine, name) { Extensible = true }; obj.FastAddProperty("constructor", errorConstructor, true, false, true); obj.FastAddProperty("message", "", true, false, true); if (name != "Error") { obj.Prototype = engine.Error.PrototypeObject; } else { obj.Prototype = engine.Object.PrototypeObject; } return obj; }
public static ErrorConstructor CreateErrorConstructor(Engine engine, string name) { var obj = new ErrorConstructor(engine); obj.Extensible = true; obj._name = name; // The value of the [[Prototype]] internal property of the Error constructor is the Function prototype object (15.11.3) obj.Prototype = engine.Function.PrototypeObject; obj.PrototypeObject = ErrorPrototype.CreatePrototypeObject(engine, obj, name); obj.SetOwnProperty("length", new PropertyDescriptor(1, PropertyFlag.AllForbidden)); // The initial value of Error.prototype is the Error prototype object obj.SetOwnProperty("prototype", new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden)); return(obj); }
public static ErrorConstructor CreateErrorConstructor(Engine engine, string name) { var obj = new ErrorConstructor(engine); obj.Extensible = true; obj._name = name; // The value of the [[Prototype]] internal property of the Error constructor is the Function prototype object (15.11.3) obj.Prototype = engine.Function.PrototypeObject; obj.PrototypeObject = ErrorPrototype.CreatePrototypeObject(engine, obj, name); obj.FastAddProperty("length", 1, false, false, false); // The initial value of Error.prototype is the Error prototype object obj.FastAddProperty("prototype", obj.PrototypeObject, false, false, false); return(obj); }
public static ErrorPrototype CreatePrototypeObject(Engine engine, ErrorConstructor errorConstructor, JsString name) { var obj = new ErrorPrototype(engine, name) { _errorConstructor = errorConstructor, }; if (name._value != "Error") { obj._prototype = engine.Error.PrototypeObject; } else { obj._prototype = engine.Object.PrototypeObject; } return(obj); }
public static ErrorConstructor CreateErrorConstructor(Engine engine, JsString name) { var obj = new ErrorConstructor(engine) { _name = name, _prototype = engine.Function.PrototypeObject }; // The value of the [[Prototype]] internal property of the Error constructor is the Function prototype object (15.11.3) obj.PrototypeObject = ErrorPrototype.CreatePrototypeObject(engine, obj, name); obj._length = PropertyDescriptor.AllForbiddenDescriptor.NumberOne; // The initial value of Error.prototype is the Error prototype object obj._prototypeDescriptor = new PropertyDescriptor(obj.PrototypeObject, PropertyFlag.AllForbidden); return(obj); }
public static ErrorPrototype CreatePrototypeObject(Engine engine, ErrorConstructor errorConstructor, string name) { var obj = new ErrorPrototype(engine, name) { Extensible = true }; obj.FastAddProperty("constructor", errorConstructor, true, false, true); obj.FastAddProperty("message", "", true, false, true); if (name != "Error") { obj.Prototype = engine.Error.PrototypeObject; } else { obj.Prototype = engine.Object.PrototypeObject; } return(obj); }