public final void initPrototypeConstructor(IdFunctionObject f) { int id = prototypeValues.constructorId; if (id == 0) throw new IllegalStateException(); if (f.methodId() != id) throw new IllegalArgumentException(); if (isSealed()) { f.sealObject(); } prototypeValues.initValue(id, "constructor", f, DONTENUM); }
private IdFunctionObject newIdFunction(Object tag, int id, String name, int arity, Scriptable scope) { IdFunctionObject f = new IdFunctionObject(this, tag, id, name, arity, scope); if (isSealed()) { f.sealObject(); } return f; }
public void initStandardObjects(Context cx, boolean sealed) { // Assume that Context.initStandardObjects initialize JavaImporter // property lazily so the above init call is not yet called cx.initStandardObjects(this, sealed); topScopeFlag = true; // If seal is true then exportAsJSClass(cx, seal) would seal // this obj. Since this is scope as well, it would not allow // to add variables. IdFunctionObject ctor = exportAsJSClass(MAX_PROTOTYPE_ID, this, false); if (sealed) { ctor.sealObject(); } // delete "constructor" defined by exportAsJSClass so "constructor" // name would refer to Object.constructor // and not to JavaImporter.prototype.constructor. delete("constructor"); }
public static void init(Context cx, Scriptable scope, boolean sealed) { JavaAdapter obj = new JavaAdapter(); IdFunctionObject ctor = new IdFunctionObject(obj, FTAG, Id_JavaAdapter, "JavaAdapter", 1, scope); ctor.markAsConstructor(null); if (sealed) { ctor.sealObject(); } ctor.exportAsScopeProperty(); }
static void init(Scriptable scope, boolean sealed) { NativeWith obj = new NativeWith(); obj.setParentScope(scope); obj.setPrototype(ScriptableObject.getObjectPrototype(scope)); IdFunctionObject ctor = new IdFunctionObject(obj, FTAG, Id_constructor, "With", 0, scope); ctor.markAsConstructor(obj); if (sealed) { ctor.sealObject(); } ctor.exportAsScopeProperty(); }
public final IdFunctionObject exportAsJSClass(int maxPrototypeId, Scriptable scope, boolean sealed) { // Set scope and prototype unless this is top level scope itself if (scope != this && scope != null) { setParentScope(scope); setPrototype(getObjectPrototype(scope)); } activatePrototypeMap(maxPrototypeId); IdFunctionObject ctor = prototypeValues.createPrecachedConstructor(); if (sealed) { sealObject(); } fillConstructorProperties(ctor); if (sealed) { ctor.sealObject(); } ctor.exportAsScopeProperty(); return ctor; }
arity, scope); if (sealed) { f.sealObject(); ctor.markAsConstructor(errorProto); if (sealed) { ctor.sealObject();