wip: working on walker (externs)

Begin working on extern walking (libs metadata collet + opcode gen)
This commit is contained in:
samsonium
2026-10-31 18:45:33 +03:00
parent a4aa220cfa
commit 4d9c4ddd21
5 changed files with 40 additions and 4 deletions
+17 -1
View File
@@ -1,6 +1,8 @@
#include <common/fzl_types.h>
#include <compiler/fzl_analyzer.h>
#include <compiler/fzl_parser.h>
#include <compiler/fzl_token.h>
#include <compiler/internals/analyzer.h>
#include <compiler/utils/fzl_symtable.h>
#include <stdbool.h>
#include <stdio.h>
@@ -101,7 +103,21 @@ fzl_type_t an_toktotype(fzl_analyzer_t *analyzer, fzl_token_t *tok,
if (sym_found)
*sym_found = found;
return found ? sym.type : FZL_TYPE_NULL;
if (found && sym.node->type == FZL_NODETYPE_CLASS)
return FZL_TYPE_OBJECT;
if (found && sym.node->type != FZL_NODETYPE_CLASS &&
sym.node->type != FZL_NODETYPE_TYPEDEF)
{
snprintf(an_problem, sizeof(an_problem), "cannot use '%s' as type",
sym.name);
an_push_error(analyzer, sym.node->token, an_problem);
return FZL_TYPE_NULL;
}
return (found || (tok->value && strcmp(tok->value, "null") == 0))
? sym.type
: FZL_TYPE_NULL;
}
if (sym_found)