static boolean isWithFunction(Object functionObj) { if (functionObj instanceof IdFunctionObject) { IdFunctionObject f = (IdFunctionObject)functionObj; return f.hasTag(FTAG) && f.methodId() == Id_constructor; } return false; }
static boolean isApplyOrCall(IdFunctionObject f) { if(f.hasTag(FUNCTION_TAG)) { switch(f.methodId()) { case Id_apply: case Id_call: return true; } } return false; }
public static boolean isContinuationConstructor(IdFunctionObject f) { if (f.hasTag(FTAG) && f.methodId() == Id_constructor) { return true; } return false; }
static boolean isEvalFunction(Object functionObj) { if (functionObj instanceof IdFunctionObject) { IdFunctionObject function = (IdFunctionObject)functionObj; if (function.hasTag(FTAG) && function.methodId() == Id_eval) { return true; } } return false; }
static boolean isApply(IdFunctionObject f) { return f.hasTag(FUNCTION_TAG) && f.methodId() == Id_apply; }
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(FTAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case Id_constructor: throw Context.reportRuntimeError("Direct call is not supported"); } throw new IllegalArgumentException(String.valueOf(id)); }
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (f.hasTag(FTAG)) { if (f.methodId() == Id_JavaAdapter) { return js_createAdapter(cx, scope, args); } } throw f.unknown(); }
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (f.hasTag(FTAG)) { if (f.methodId() == Id_constructor) { throw Context.reportRuntimeError1("msg.cant.call.indirect", "With"); } } throw f.unknown(); }
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (f.hasTag(FTAG)) { if (f.methodId() == Id_getClass) { return js_getClass(cx, scope, args); } } throw f.unknown(); }
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(ERROR_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case Id_constructor: return make(cx, scope, f, args); case Id_toString: return js_toString(thisObj); case Id_toSource: return js_toSource(cx, scope, thisObj); } throw new IllegalArgumentException(String.valueOf(id)); }
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(ITERATOR_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); if (id == Id_constructor) { return jsConstructor(cx, scope, thisObj, args); } if (!(thisObj instanceof NativeIterator)) throw incompatibleCallError(f); NativeIterator iterator = (NativeIterator) thisObj; switch (id) { case Id_next: return iterator.next(cx, scope); case Id___iterator__: /// XXX: what about argument? SpiderMonkey apparently ignores it return thisObj; default: throw new IllegalArgumentException(String.valueOf(id)); } }
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(CALL_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); if (id == Id_constructor) { if (thisObj != null) { throw Context.reportRuntimeError1("msg.only.from.new", "Call"); } ScriptRuntime.checkDeprecated(cx, "Call"); NativeCall result = new NativeCall(); result.setPrototype(getObjectPrototype(scope)); return result; } throw new IllegalArgumentException(String.valueOf(id)); }
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(IMPORTER_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case Id_constructor: return js_construct(scope, args); case Id_importClass: return realThis(thisObj, f).js_importClass(args); case Id_importPackage: return realThis(thisObj, f).js_importPackage(args); } throw new IllegalArgumentException(String.valueOf(id)); }
Scriptable thisObj, Object[] args) if (!f.hasTag(GENERATOR_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args);
Scriptable thisObj, Object[] args) if (!f.hasTag(BOOLEAN_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args);
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(REGEXP_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { case Id_compile: return realThis(thisObj, f).compile(cx, scope, args); case Id_toString: case Id_toSource: return realThis(thisObj, f).toString(); case Id_exec: return realThis(thisObj, f).execSub(cx, scope, args, MATCH); case Id_test: { Object x = realThis(thisObj, f).execSub(cx, scope, args, TEST); return Boolean.TRUE.equals(x) ? Boolean.TRUE : Boolean.FALSE; } case Id_prefix: return realThis(thisObj, f).execSub(cx, scope, args, PREFIX); } throw new IllegalArgumentException(String.valueOf(id)); }
Scriptable thisObj, Object[] args) if (!f.hasTag(NUMBER_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args);
Scriptable thisObj, Object[] args) if (!f.hasTag(FUNCTION_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args);
Scriptable thisObj, Object[] args) if (!f.hasTag(SCRIPT_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args);
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) if (f.hasTag(FTAG)) { int methodId = f.methodId(); switch (methodId) {