mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 20:31:58 +00:00
Make FromJSProperty actually part of ScriptInterface.
Reviewed By: Imarok Differential Revision: https://code.wildfiregames.com/D876 This was SVN commit r20179.
This commit is contained in:
@@ -86,13 +86,13 @@ template<> bool ScriptInterface::FromJSVal<std::vector<T> >(JSContext* cx, JS::H
|
||||
return FromJSVal_vector(cx, v, out); \
|
||||
}
|
||||
|
||||
template<typename T> static bool FromJSProperty(JSContext* cx, JS::HandleValue v, const char* name, T& out)
|
||||
template<typename T> bool ScriptInterface::FromJSProperty(JSContext* cx, const JS::HandleValue val, const char* name, T& ret)
|
||||
{
|
||||
if (!v.isObject())
|
||||
if (!val.isObject())
|
||||
return false;
|
||||
|
||||
JSAutoRequest rq(cx);
|
||||
JS::RootedObject obj(cx, &v.toObject());
|
||||
JS::RootedObject obj(cx, &val.toObject());
|
||||
|
||||
bool hasProperty;
|
||||
if (!JS_HasProperty(cx, obj, name, &hasProperty) || !hasProperty)
|
||||
@@ -102,7 +102,7 @@ template<typename T> static bool FromJSProperty(JSContext* cx, JS::HandleValue v
|
||||
if (!JS_GetProperty(cx, obj, name, &value))
|
||||
return false;
|
||||
|
||||
return ScriptInterface::FromJSVal(cx, value, out);
|
||||
return FromJSVal(cx, value, ret);
|
||||
}
|
||||
|
||||
#endif //INCLUDED_SCRIPTCONVERSIONS
|
||||
|
||||
Reference in New Issue
Block a user