forked from mirrors/0ad
Adapt 0 A.D. to SpiderMonkey ESR 102
This follows the migration guide at: https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples Based on patch by: wraitii Differential Revision: https://code.wildfiregames.com/D5002
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -62,7 +62,7 @@ template<> void Script::ToJSVal<IComponent*>(const ScriptRequest& rq, JS::Mutab
|
||||
return;
|
||||
}
|
||||
|
||||
JS::SetPrivate(obj, static_cast<void*>(val));
|
||||
JS::SetReservedSlot(obj, ScriptInterface::JSObjectReservedSlots::PRIVATE, JS::PrivateValue(val));
|
||||
ret.setObject(*obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -81,11 +81,6 @@ void CBinarySerializerScriptImpl::HandleScriptVal(JS::HandleValue val)
|
||||
m_Serializer.NumberU8_Unbounded("type", SCRIPT_TYPE_VOID);
|
||||
break;
|
||||
}
|
||||
case JSTYPE_NULL: // This type is never actually returned (it's a JS2 feature)
|
||||
{
|
||||
m_Serializer.NumberU8_Unbounded("type", SCRIPT_TYPE_NULL);
|
||||
break;
|
||||
}
|
||||
case JSTYPE_OBJECT:
|
||||
{
|
||||
if (val.isNull())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#define BEGIN_INTERFACE_WRAPPER(iname) \
|
||||
JSClass class_ICmp##iname = { \
|
||||
"ICmp" #iname, JSCLASS_HAS_PRIVATE \
|
||||
"ICmp" #iname, JSCLASS_HAS_RESERVED_SLOTS( ScriptInterface::JSObjectReservedSlots::PRIVATE+1 ) \
|
||||
}; \
|
||||
static JSFunctionSpec methods_ICmp##iname[] = {
|
||||
|
||||
@@ -43,13 +43,13 @@
|
||||
ICmp##iname::InterfaceInit(scriptInterface); \
|
||||
}
|
||||
|
||||
template <typename T, JSClass* jsClass>
|
||||
template <typename T>
|
||||
inline T* ComponentGetter(const ScriptRequest& rq, JS::CallArgs& args)
|
||||
{
|
||||
return ScriptInterface::GetPrivate<T>(rq, args, jsClass);
|
||||
return ScriptInterface::GetPrivate<T>(rq, args);
|
||||
}
|
||||
|
||||
#define DEFINE_INTERFACE_METHOD(scriptname, classname, methodname) \
|
||||
ScriptFunction::Wrap<&classname::methodname, ComponentGetter<classname, &class_##classname>>(scriptname),
|
||||
ScriptFunction::Wrap<&classname::methodname, ComponentGetter<classname>>(scriptname),
|
||||
|
||||
#endif // INCLUDED_INTERFACE_SCRIPTED
|
||||
|
||||
Reference in New Issue
Block a user