feat: added parent modules to function name

This commit is contained in:
Sven Vogel 2024-10-10 10:03:41 +02:00
parent af83cb4f4e
commit d133a8a0f0
1 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,4 @@
#include "cfg/opt.h"
#include <assert.h> #include <assert.h>
#include <ast/ast.h> #include <ast/ast.h>
#include <glib.h> #include <glib.h>
@ -2626,6 +2627,12 @@ int createFunction(Function* function, AST_NODE_PTR currentNode) {
return SEMANTIC_ERROR; return SEMANTIC_ERROR;
} }
// compose function name by appending parent modules
char* modules = module_ref_to_str(currentNode->location.module_ref);
char* composed_name = g_strjoin("", modules, ":", function->name, NULL);
g_free(modules);
function->name = composed_name;
mem_free(functionParameter); mem_free(functionParameter);
functionParameter = NULL; functionParameter = NULL;