public static Scriptable leaveWith(Scriptable scope) { NativeWith nw = (NativeWith)scope; return nw.getParentScope(); }
public static Object updateDotQuery(boolean value, Scriptable scope) { // Return null to continue looping NativeWith nw = (NativeWith)scope; return nw.updateDotQuery(value); }
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args) { ScriptRuntime.checkDeprecated(cx, "With"); scope = ScriptableObject.getTopLevelScope(scope); NativeWith thisObj = new NativeWith(); thisObj.setPrototype(args.length == 0 ? ScriptableObject.getClassPrototype(scope, "Object") : ScriptRuntime.toObject(cx, scope, args[0])); thisObj.setParentScope(scope); return thisObj; }
public static Object newSpecial(Context cx, Object fun, Object[] args, Scriptable scope, int callType) { if (callType == Node.SPECIALCALL_EVAL) { if (NativeGlobal.isEvalFunction(fun)) { throw typeError1("msg.not.ctor", "eval"); } } else if (callType == Node.SPECIALCALL_WITH) { if (NativeWith.isWithFunction(fun)) { return NativeWith.newWithSpecial(cx, scope, args); } } else { throw Kit.codeBug(); } return newObject(fun, cx, scope, args); }
public static Scriptable enterWith(Object obj, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj); if (sobj == null) { throw typeError1("msg.undef.with", toString(obj)); } if (sobj instanceof XMLObject) { XMLObject xmlObject = (XMLObject)sobj; return xmlObject.enterWith(scope); } return new NativeWith(scope, sobj); }
public static Object callSpecial(Context cx, Callable fun, Scriptable thisObj, Object[] args, Scriptable scope, Scriptable callerThis, int callType, String filename, int lineNumber) { if (callType == Node.SPECIALCALL_EVAL) { if (NativeGlobal.isEvalFunction(fun)) { return evalSpecial(cx, scope, callerThis, args, filename, lineNumber); } } else if (callType == Node.SPECIALCALL_WITH) { if (NativeWith.isWithFunction(fun)) { throw Context.reportRuntimeError1("msg.only.from.new", "With"); } } else { throw Kit.codeBug(); } return fun.call(cx, scope, thisObj, args); }
NativeMath.init(scope, sealed); NativeWith.init(scope, sealed); NativeCall.init(scope, sealed); NativeScript.init(scope, sealed);
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 static Scriptable leaveDotQuery(Scriptable scope) { NativeWith nw = (NativeWith)scope; return nw.getParentScope(); }