fix: mangle function name only when parent module is available

This commit is contained in:
Sven Vogel 2024-10-10 23:27:40 +02:00
parent a8bceff951
commit 26bc5a796a
1 changed files with 8 additions and 6 deletions

View File

@ -2698,6 +2698,7 @@ int createFunction(Function* function, AST_NODE_PTR currentNode) {
// compose function name by appending parent modules
char* modules = module_ref_to_str(currentNode->location.module_ref);
if (strlen(modules) > 0) {
char* composed_name =
g_strjoin("", modules, "::", function->name, NULL);
char* cached_composed_name =
@ -2706,6 +2707,7 @@ int createFunction(Function* function, AST_NODE_PTR currentNode) {
g_free(composed_name);
function->name = cached_composed_name;
}
}
mem_free(functionParameter);
functionParameter = NULL;