diff --git a/source/gui/scripting/JSInterface_GUITypes.cpp b/source/gui/scripting/JSInterface_GUITypes.cpp index 860ae9532f..65fbac5d68 100644 --- a/source/gui/scripting/JSInterface_GUITypes.cpp +++ b/source/gui/scripting/JSInterface_GUITypes.cpp @@ -51,38 +51,27 @@ JSFunctionSpec JSI_GUISize::JSI_methods[] = JSBool JSI_GUISize::construct(JSContext* cx, uint argc, jsval* vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JSObject* obj = JS_NewObject(cx, &JSI_GUISize::JSI_class, NULL, NULL); - if (argc == 8) + if (args.length() == 8) { - JS::RootedValue v0(cx, JS_ARGV(cx, vp)[0]); - JS::RootedValue v1(cx, JS_ARGV(cx, vp)[1]); - JS::RootedValue v2(cx, JS_ARGV(cx, vp)[2]); - JS::RootedValue v3(cx, JS_ARGV(cx, vp)[3]); - JS::RootedValue v4(cx, JS_ARGV(cx, vp)[4]); - JS::RootedValue v5(cx, JS_ARGV(cx, vp)[5]); - JS::RootedValue v6(cx, JS_ARGV(cx, vp)[6]); - JS::RootedValue v7(cx, JS_ARGV(cx, vp)[7]); - JS_SetProperty(cx, obj, "left", v0.address()); - JS_SetProperty(cx, obj, "top", v1.address()); - JS_SetProperty(cx, obj, "right", v2.address()); - JS_SetProperty(cx, obj, "bottom", v3.address()); - JS_SetProperty(cx, obj, "rleft", v4.address()); - JS_SetProperty(cx, obj, "rtop", v5.address()); - JS_SetProperty(cx, obj, "rright", v6.address()); - JS_SetProperty(cx, obj, "rbottom", v7.address()); + JS_SetProperty(cx, obj, "left", &args[0]); + JS_SetProperty(cx, obj, "top", &args[1]); + JS_SetProperty(cx, obj, "right", &args[2]); + JS_SetProperty(cx, obj, "bottom", &args[3]); + JS_SetProperty(cx, obj, "rleft", &args[4]); + JS_SetProperty(cx, obj, "rtop", &args[5]); + JS_SetProperty(cx, obj, "rright", &args[6]); + JS_SetProperty(cx, obj, "rbottom", &args[7]); } - else if (argc == 4) + else if (args.length() == 4) { JS::RootedValue zero(cx, JSVAL_ZERO); - JS::RootedValue v0(cx, JS_ARGV(cx, vp)[0]); - JS::RootedValue v1(cx, JS_ARGV(cx, vp)[1]); - JS::RootedValue v2(cx, JS_ARGV(cx, vp)[2]); - JS::RootedValue v3(cx, JS_ARGV(cx, vp)[3]); - JS_SetProperty(cx, obj, "left", v0.address()); - JS_SetProperty(cx, obj, "top", v1.address()); - JS_SetProperty(cx, obj, "right", v2.address()); - JS_SetProperty(cx, obj, "bottom", v3.address()); + JS_SetProperty(cx, obj, "left", &args[0]); + JS_SetProperty(cx, obj, "top", &args[1]); + JS_SetProperty(cx, obj, "right", &args[2]); + JS_SetProperty(cx, obj, "bottom", &args[3]); JS_SetProperty(cx, obj, "rleft", zero.address()); JS_SetProperty(cx, obj, "rtop", zero.address()); JS_SetProperty(cx, obj, "rright", zero.address()); @@ -101,7 +90,7 @@ JSBool JSI_GUISize::construct(JSContext* cx, uint argc, jsval* vp) JS_SetProperty(cx, obj, "rbottom", zero.address()); } - JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); + args.rval().setObject(*obj); return JS_TRUE; } @@ -117,7 +106,7 @@ CStr ToPercentString(double pix, double per) JSBool JSI_GUISize::toString(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); - + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); CStr buffer; try @@ -125,8 +114,8 @@ JSBool JSI_GUISize::toString(JSContext* cx, uint argc, jsval* vp) ScriptInterface* pScriptInterface = ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface; double val, valr; #define SIDE(side) \ - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), #side, val); \ - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "r"#side, valr); \ + pScriptInterface->GetProperty(rec.thisv(), #side, val); \ + pScriptInterface->GetProperty(rec.thisv(), "r"#side, valr); \ buffer += ToPercentString(val, valr); SIDE(left); buffer += " "; @@ -139,11 +128,11 @@ JSBool JSI_GUISize::toString(JSContext* cx, uint argc, jsval* vp) } catch (PSERROR_Scripting_ConversionFailed&) { - JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, ""))); + rec.rval().setString(JS_NewStringCopyZ(cx, "")); return JS_TRUE; } - JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buffer.c_str()))); + rec.rval().setString(JS_NewStringCopyZ(cx, buffer.c_str())); return JS_TRUE; } @@ -177,14 +166,15 @@ JSFunctionSpec JSI_GUIColor::JSI_methods[] = JSBool JSI_GUIColor::construct(JSContext* cx, uint argc, jsval* vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JSObject* obj = JS_NewObject(cx, &JSI_GUIColor::JSI_class, NULL, NULL); - if (argc == 4) + if (args.length() == 4) { - JS_SetProperty(cx, obj, "r", &JS_ARGV(cx, vp)[0]); - JS_SetProperty(cx, obj, "g", &JS_ARGV(cx, vp)[1]); - JS_SetProperty(cx, obj, "b", &JS_ARGV(cx, vp)[2]); - JS_SetProperty(cx, obj, "a", &JS_ARGV(cx, vp)[3]); + JS_SetProperty(cx, obj, "r", &args[0]); + JS_SetProperty(cx, obj, "g", &args[1]); + JS_SetProperty(cx, obj, "b", &args[2]); + JS_SetProperty(cx, obj, "a", &args[3]); } else { @@ -197,20 +187,21 @@ JSBool JSI_GUIColor::construct(JSContext* cx, uint argc, jsval* vp) JS_SetProperty(cx, obj, "g", c.address()); } - JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); + args.rval().setObject(*obj); return JS_TRUE; } JSBool JSI_GUIColor::toString(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); double r, g, b, a; ScriptInterface* pScriptInterface = ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface; - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "r", r); - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "g", g); - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "b", b); - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "a", a); + pScriptInterface->GetProperty(rec.thisv(), "r", r); + pScriptInterface->GetProperty(rec.thisv(), "g", g); + pScriptInterface->GetProperty(rec.thisv(), "b", b); + pScriptInterface->GetProperty(rec.thisv(), "a", a); char buffer[256]; // Convert to integers, to be compatible with the GUI's string SetSetting snprintf(buffer, 256, "%d %d %d %d", @@ -218,7 +209,7 @@ JSBool JSI_GUIColor::toString(JSContext* cx, uint argc, jsval* vp) (int)(255.0 * g), (int)(255.0 * b), (int)(255.0 * a)); - JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buffer))); + rec.rval().setString(JS_NewStringCopyZ(cx, buffer)); return JS_TRUE; } @@ -250,16 +241,15 @@ JSFunctionSpec JSI_GUIMouse::JSI_methods[] = JSBool JSI_GUIMouse::construct(JSContext* cx, uint argc, jsval* vp) { + JSAutoRequest rq(cx); + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JSObject* obj = JS_NewObject(cx, &JSI_GUIMouse::JSI_class, NULL, NULL); - if (argc == 3) + if (args.length() == 3) { - JS::RootedValue v0(cx, JS_ARGV(cx, vp)[0]); - JS::RootedValue v1(cx, JS_ARGV(cx, vp)[1]); - JS::RootedValue v2(cx, JS_ARGV(cx, vp)[2]); - JS_SetProperty(cx, obj, "x", v0.address()); - JS_SetProperty(cx, obj, "y", v1.address()); - JS_SetProperty(cx, obj, "buttons", v2.address()); + JS_SetProperty(cx, obj, "x", &args[0]); + JS_SetProperty(cx, obj, "y", &args[1]); + JS_SetProperty(cx, obj, "buttons", &args[2]); } else { @@ -269,23 +259,24 @@ JSBool JSI_GUIMouse::construct(JSContext* cx, uint argc, jsval* vp) JS_SetProperty(cx, obj, "buttons", zero.address()); } - JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); + args.rval().setObject(*obj); return JS_TRUE; } JSBool JSI_GUIMouse::toString(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); i32 x, y, buttons; ScriptInterface* pScriptInterface = ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface; - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "x", x); - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "y", y); - pScriptInterface->GetProperty(JS_THIS_VALUE(cx, vp), "buttons", buttons); + pScriptInterface->GetProperty(rec.thisv(), "x", x); + pScriptInterface->GetProperty(rec.thisv(), "y", y); + pScriptInterface->GetProperty(rec.thisv(), "buttons", buttons); char buffer[256]; snprintf(buffer, 256, "%d %d %d", x, y, buttons); - JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buffer))); + rec.rval().setString(JS_NewStringCopyZ(cx, buffer)); return JS_TRUE; } diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 95649f664b..d534a497d5 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -593,7 +593,8 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JS::HandleObject obj, JS::Hand JSBool JSI_IGUIObject::construct(JSContext* cx, uint argc, jsval* vp) { - if (argc == 0) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() == 0) { JS_ReportError(cx, "GUIObject has no default constructor"); return JS_FALSE; @@ -602,10 +603,10 @@ JSBool JSI_IGUIObject::construct(JSContext* cx, uint argc, jsval* vp) JS::RootedObject obj(cx, JS_NewObject(cx, &JSI_IGUIObject::JSI_class, NULL, NULL)); // Store the IGUIObject in the JS object's 'private' area - IGUIObject* guiObject = (IGUIObject*)JSVAL_TO_PRIVATE(JS_ARGV(cx, vp)[0]); + IGUIObject* guiObject = (IGUIObject*)JSVAL_TO_PRIVATE(args[0]); JS_SetPrivate(obj, guiObject); - JS_SET_RVAL(cx, vp, JS::ObjectValue(*obj)); + args.rval().setObject(*obj); return JS_TRUE; } @@ -617,6 +618,7 @@ void JSI_IGUIObject::init(ScriptInterface& scriptInterface) JSBool JSI_IGUIObject::toString(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); IGUIObject* e = (IGUIObject*)JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx, vp), &JSI_IGUIObject::JSI_class, NULL); if (!e) @@ -625,13 +627,14 @@ JSBool JSI_IGUIObject::toString(JSContext* cx, uint argc, jsval* vp) char buffer[256]; snprintf(buffer, 256, "[GUIObject: %s]", e->GetName().c_str()); buffer[255] = 0; - JS_SET_RVAL(cx, vp, JS::StringValue(JS_NewStringCopyZ(cx, buffer))); + rec.rval().setString(JS_NewStringCopyZ(cx, buffer)); return JS_TRUE; } JSBool JSI_IGUIObject::focus(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); IGUIObject* e = (IGUIObject*)JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx, vp), &JSI_IGUIObject::JSI_class, NULL); if (!e) @@ -639,13 +642,14 @@ JSBool JSI_IGUIObject::focus(JSContext* cx, uint argc, jsval* vp) e->GetGUI()->SetFocusedObject(e); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + rec.rval().setUndefined(); return JS_TRUE; } JSBool JSI_IGUIObject::blur(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); IGUIObject* e = (IGUIObject*)JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx, vp), &JSI_IGUIObject::JSI_class, NULL); if (!e) @@ -653,13 +657,15 @@ JSBool JSI_IGUIObject::blur(JSContext* cx, uint argc, jsval* vp) e->GetGUI()->SetFocusedObject(NULL); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + rec.rval().setUndefined(); return JS_TRUE; } JSBool JSI_IGUIObject::getComputedSize(JSContext* cx, uint argc, jsval* vp) { UNUSED2(argc); + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); + IGUIObject* e = (IGUIObject*)JS_GetInstancePrivate(cx, JS_THIS_OBJECT(cx, vp), &JSI_IGUIObject::JSI_class, NULL); if (!e) return JS_FALSE; @@ -682,6 +688,6 @@ JSBool JSI_IGUIObject::getComputedSize(JSContext* cx, uint argc, jsval* vp) return JS_FALSE; } - JS_SET_RVAL(cx, vp, objVal); + rec.rval().set(objVal); return JS_TRUE; } diff --git a/source/scriptinterface/NativeWrapperDecls.h b/source/scriptinterface/NativeWrapperDecls.h index 13d686f52e..aa2ade84cb 100644 --- a/source/scriptinterface/NativeWrapperDecls.h +++ b/source/scriptinterface/NativeWrapperDecls.h @@ -26,7 +26,7 @@ #define NUMBERED_LIST_BALANCED(z, i, data) BOOST_PP_COMMA_IF(i) data##i // Some other things #define TYPED_ARGS(z, i, data) , T##i a##i -#define CONVERT_ARG(z, i, data) T##i a##i; if (! ScriptInterface::FromJSVal(cx, i < argc ? JS_ARGV(cx, vp)[i] : JS::UndefinedValue(), a##i)) return false; +#define CONVERT_ARG(z, i, data) T##i a##i; if (! ScriptInterface::FromJSVal(cx, i < args.length() ? args[i] : JS::UndefinedValue(), a##i)) return false; // List-generating macros, named roughly after their first list item #define TYPENAME_T0_HEAD(z, i) BOOST_PP_REPEAT_##z (i, NUMBERED_LIST_HEAD, typename T) // "typename T0, typename T1, " diff --git a/source/scriptinterface/NativeWrapperDefns.h b/source/scriptinterface/NativeWrapperDefns.h index fe37f93655..7fb218813c 100644 --- a/source/scriptinterface/NativeWrapperDefns.h +++ b/source/scriptinterface/NativeWrapperDefns.h @@ -92,12 +92,12 @@ struct ScriptInterface_NativeMethodWrapper { #define OVERLOADS(z, i, data) \ template \ JSBool ScriptInterface::call(JSContext* cx, uint argc, jsval* vp) { \ - UNUSED2(argc); \ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \ SCRIPT_PROFILE \ BOOST_PP_REPEAT_##z (i, CONVERT_ARG, ~) \ jsval rval = JSVAL_VOID; \ ScriptInterface_NativeWrapper::call(cx, rval, fptr A0_TAIL(z,i)); \ - JS_SET_RVAL(cx, vp, rval); \ + args.rval().set(rval); \ return !ScriptInterface::IsExceptionPending(cx); \ } BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~) @@ -107,7 +107,7 @@ BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~) #define OVERLOADS(z, i, data) \ template \ JSBool ScriptInterface::callMethod(JSContext* cx, uint argc, jsval* vp) { \ - UNUSED2(argc); \ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); \ SCRIPT_PROFILE \ if (ScriptInterface::GetClass(JS_THIS_OBJECT(cx, vp)) != CLS) return false; \ TC* c = static_cast(ScriptInterface::GetPrivate(JS_THIS_OBJECT(cx, vp))); \ @@ -115,7 +115,7 @@ BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~) BOOST_PP_REPEAT_##z (i, CONVERT_ARG, ~) \ jsval rval = JSVAL_VOID; \ ScriptInterface_NativeMethodWrapper::call(cx, rval, c, fptr A0_TAIL(z,i)); \ - JS_SET_RVAL(cx, vp, rval); \ + args.rval().set(rval); \ return !ScriptInterface::IsExceptionPending(cx); \ } BOOST_PP_REPEAT(SCRIPT_INTERFACE_MAX_ARGS, OVERLOADS, ~) diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index 65f69b98a1..c2f42e116a 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -464,80 +464,82 @@ void ErrorReporter(JSContext* cx, const char* message, JSErrorReport* report) JSBool print(JSContext* cx, uint argc, jsval* vp) { - for (uint i = 0; i < argc; ++i) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + for (uint i = 0; i < args.length(); ++i) { std::wstring str; - if (!ScriptInterface::FromJSVal(cx, JS_ARGV(cx, vp)[i], str)) + if (!ScriptInterface::FromJSVal(cx, args[i], str)) return JS_FALSE; debug_printf(L"%ls", str.c_str()); } fflush(stdout); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } JSBool logmsg(JSContext* cx, uint argc, jsval* vp) { - if (argc < 1) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() < 1) { - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } std::wstring str; - if (!ScriptInterface::FromJSVal(cx, JS_ARGV(cx, vp)[0], str)) + if (!ScriptInterface::FromJSVal(cx, args[0], str)) return JS_FALSE; LOGMESSAGE(L"%ls", str.c_str()); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } JSBool warn(JSContext* cx, uint argc, jsval* vp) { - if (argc < 1) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() < 1) { - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } std::wstring str; - if (!ScriptInterface::FromJSVal(cx, JS_ARGV(cx, vp)[0], str)) + if (!ScriptInterface::FromJSVal(cx, args[0], str)) return JS_FALSE; LOGWARNING(L"%ls", str.c_str()); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } JSBool error(JSContext* cx, uint argc, jsval* vp) { - if (argc < 1) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() < 1) { - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } std::wstring str; - if (!ScriptInterface::FromJSVal(cx, JS_ARGV(cx, vp)[0], str)) + if (!ScriptInterface::FromJSVal(cx, args[0], str)) return JS_FALSE; LOGERROR(L"%ls", str.c_str()); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } JSBool deepcopy(JSContext* cx, uint argc, jsval* vp) { - if (argc < 1) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() < 1) { - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } - jsval ret; - - if (!JS_StructuredClone(cx, JS_ARGV(cx, vp)[0], &ret, NULL, NULL)) + if (!JS_StructuredClone(cx, args[0], args.rval().address(), NULL, NULL)) return JS_FALSE; - JS_SET_RVAL(cx, vp, ret); return JS_TRUE; } @@ -545,10 +547,11 @@ JSBool ProfileStart(JSContext* cx, uint argc, jsval* vp) { const char* name = "(ProfileStart)"; - if (argc >= 1) + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (args.length() >= 1) { std::string str; - if (!ScriptInterface::FromJSVal(cx, JS_ARGV(cx, vp)[0], str)) + if (!ScriptInterface::FromJSVal(cx, args[0], str)) return JS_FALSE; typedef boost::flyweight< @@ -565,18 +568,19 @@ JSBool ProfileStart(JSContext* cx, uint argc, jsval* vp) g_Profiler2.RecordRegionEnter(name); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + args.rval().setUndefined(); return JS_TRUE; } JSBool ProfileStop(JSContext* UNUSED(cx), uint UNUSED(argc), jsval* vp) { + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); if (CProfileManager::IsInitialised() && ThreadUtil::IsMainThread()) g_Profiler.Stop(); g_Profiler2.RecordRegionLeave("(ProfileStop)"); - JS_SET_RVAL(cx, vp, JSVAL_VOID); + rec.rval().setUndefined(); return JS_TRUE; } @@ -600,12 +604,12 @@ static double generate_uniform_real(boost::rand48& rng, double min, double max) JSBool Math_random(JSContext* cx, uint UNUSED(argc), jsval* vp) { + JS::CallReceiver rec = JS::CallReceiverFromVp(vp); double r; if(!ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface->MathRandom(r)) return JS_FALSE; - jsval rv = JS::NumberValue(r); - JS_SET_RVAL(cx, vp, rv); + rec.rval().setNumber(r); return JS_TRUE; }