Introduce C++ templates replacements for DEFINE_INTERFACE_X and RegisterFunction macros

The new methods:
- aren't included in ScriptInterface.h directly, lightening that header
- don't use boost CPP
- don't need argument types or number or constness to be specified
- can work with object methods somewhat transparently
- support optional cmptPrivate (allowing removal of many UNUSED macro)
- support optional const ScriptRequest&, which is safer.

This first diff changes only some of the JSI files & the component
manager. Further diffs will update other files and finally delete the
current code.

Differential Revision: https://code.wildfiregames.com/D2818
This was SVN commit r24969.
This commit is contained in:
wraitii
2021-03-01 20:52:24 +00:00
parent 9ed3b88d25
commit f3aedf88a6
17 changed files with 562 additions and 243 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ struct ScriptInterface_impl
};
ScriptRequest::ScriptRequest(const ScriptInterface& scriptInterface) :
cx(scriptInterface.m->m_cx)
cx(scriptInterface.m->m_cx), nativeScope(scriptInterface.m->m_nativeScope)
{
m_formerRealm = JS::EnterRealm(cx, scriptInterface.m->m_glob);
glob = JS::CurrentGlobalOrNull(cx);