Compare commits

...

1 Commits

Author SHA1 Message Date
Davy Hélard
3a113ea419 Generate ObjectsLists names without mangled namespace 2023-04-04 14:15:03 +02:00
4 changed files with 29 additions and 3 deletions

View File

@@ -1256,6 +1256,11 @@ size_t EventsCodeGenerator::GenerateSingleUsageUniqueIdFor(
gd::String EventsCodeGenerator::GetObjectListName(
const gd::String& name, const gd::EventsCodeGenerationContext& context) {
return GetObjectListNameWithoutNamespace(name, context);
}
gd::String EventsCodeGenerator::GetObjectListNameWithoutNamespace(
const gd::String& name, const gd::EventsCodeGenerationContext& context) {
return ManObjListName(name);
}

View File

@@ -435,6 +435,15 @@ class GD_CORE_API EventsCodeGenerator {
*/
virtual gd::String GetObjectListName(
const gd::String& name, const gd::EventsCodeGenerationContext& context);
/**
* \brief Get the list of objects full name without the namespace.
*
* Default implementation simply returns the name mangled using
* gd::EventsCodeNameMangler.
*/
virtual gd::String GetObjectListNameWithoutNamespace(
const gd::String& name, const gd::EventsCodeGenerationContext& context);
/**
* \brief Generate the code to notify the profiler of the beginning of a

View File

@@ -945,7 +945,13 @@ gd::String EventsCodeGenerator::GenerateBehaviorAction(
gd::String EventsCodeGenerator::GetObjectListName(
const gd::String& name, const gd::EventsCodeGenerationContext& context) {
return GetCodeNamespaceAccessor() + ManObjListName(name) +
return GetCodeNamespaceAccessor() +
GetObjectListNameWithoutNamespace(name, context);
}
gd::String EventsCodeGenerator::GetObjectListNameWithoutNamespace(
const gd::String& name, const gd::EventsCodeGenerationContext& context) {
return ManObjListName(name) +
gd::String::From(context.GetLastDepthObjectListWasNeeded(name));
}
@@ -1159,8 +1165,8 @@ gd::String EventsCodeGenerator::GenerateObject(
// Map each declared object to its list.
for (auto& objectName : declaredObjectNames) {
objectsMapName +=
ManObjListName(GetObjectListName(objectName, context));
objectsMapName += ManObjListName(
GetObjectListNameWithoutNamespace(objectName, context));
if (!mapDeclaration.empty()) mapDeclaration += ", ";
mapDeclaration += "\"" + ConvertToString(objectName) +

View File

@@ -190,6 +190,12 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
*/
virtual gd::String GetObjectListName(
const gd::String& name, const gd::EventsCodeGenerationContext& context);
/**
* \brief Get the list of objects full name without the namespace.
*/
virtual gd::String GetObjectListNameWithoutNamespace(
const gd::String& name, const gd::EventsCodeGenerationContext& context);
/**
* \brief Get the namespace to be used to store code generated