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:
leper
2017-09-12 22:52:15 +00:00
parent 66bdc460f4
commit 189da09a7e
2 changed files with 9 additions and 4 deletions
+4 -4
View File
@@ -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