@Override public Object getDefaultValue(Class<?> typeHint) { // This is actually non-ECMA, but will be proposed // as a change in round 2. if (typeHint == ScriptRuntime.BooleanClass) return ScriptRuntime.wrapBoolean(booleanValue); return super.getDefaultValue(typeHint); }
@Override protected Object getInstanceIdValue(int id) { switch (id) { case Id_lastIndex: return ScriptRuntime.wrapNumber(lastIndex); case Id_source: return new String(re.source); case Id_global: return ScriptRuntime.wrapBoolean((re.flags & JSREG_GLOB) != 0); case Id_ignoreCase: return ScriptRuntime.wrapBoolean((re.flags & JSREG_FOLD) != 0); case Id_multiline: return ScriptRuntime.wrapBoolean((re.flags & JSREG_MULTILINE) != 0); } return super.getInstanceIdValue(id); }
public static Object refDel(Ref ref, Context cx) { return wrapBoolean(ref.delete(cx)); }
/** * The delete operator * * See ECMA 11.4.1 * * In ECMA 0.19, the description of the delete operator (11.4.1) * assumes that the [[Delete]] method returns a value. However, * the definition of the [[Delete]] operator (8.6.2.5) does not * define a return value. Here we assume that the [[Delete]] * method doesn't return a value. */ public static Object delete(Object obj, Object id, Context cx) { Scriptable sobj = toObjectOrNull(cx, obj); if (sobj == null) { String idStr = (id == null) ? "null" : id.toString(); throw typeError2("msg.undef.prop.delete", toString(obj), idStr); } boolean result = deleteObjectElem(sobj, id, cx); return wrapBoolean(result); }
return ScriptRuntime.wrapBoolean(b); return ScriptRuntime.wrapBoolean(value);
case Id_multiline: case Id_STAR: return ScriptRuntime.wrapBoolean(impl.multiline);
&& d != Double.NEGATIVE_INFINITY); return ScriptRuntime.wrapBoolean(result); result = (d != d); return ScriptRuntime.wrapBoolean(result); ? Undefined.instance : args[0]; XMLLib xmlLib = XMLLib.extractFromScope(scope); return ScriptRuntime.wrapBoolean( xmlLib.isXMLName(cx, name));
String s1 = ScriptRuntime.toString(thisObj); String s2 = ScriptRuntime.toString(args, 0); return ScriptRuntime.wrapBoolean( (id == Id_equals) ? s1.equals(s2) : s1.equalsIgnoreCase(s2));
return ScriptRuntime.wrapBoolean(result); return ScriptRuntime.wrapBoolean(result); return ScriptRuntime.wrapBoolean(result);
stack[stackTop] = ScriptRuntime.wrapBoolean(valBln); continue Loop; valBln = ScriptRuntime.instanceOf(lhs, rhs, cx); stack[stackTop] = ScriptRuntime.wrapBoolean(valBln); continue Loop; stack[stackTop] = ScriptRuntime.wrapBoolean(valBln); continue Loop; boolean valBln = shallowEquals(stack, sDbl, stackTop); valBln ^= (op == Token.SHNE); stack[stackTop] = ScriptRuntime.wrapBoolean(valBln); continue Loop; stack[stackTop] = ScriptRuntime.wrapBoolean( !stack_boolean(frame, stackTop)); continue Loop;