feat: implement extern block analyzer
This commit is contained in:
@@ -20,14 +20,23 @@ fzl_an_res_t analyze_declaration(fzl_analyzer_t *analyzer, fzl_node_t *decl)
|
||||
}
|
||||
|
||||
char *name = (char *)decl->var.identifier->token->value;
|
||||
fzl_type_t type = an_toktotype(decl->var.type);
|
||||
bool type_found = false;
|
||||
fzl_type_t type = an_toktotype(analyzer, decl->var.type, &type_found);
|
||||
|
||||
if (!type_found)
|
||||
{
|
||||
snprintf(an_problem, sizeof(an_problem), "symbol '%s' not found",
|
||||
(char *)decl->var.type->value);
|
||||
an_push_error(analyzer, decl->var.type, an_problem);
|
||||
return (fzl_an_res_t){.error = true};
|
||||
}
|
||||
|
||||
char *classname = NULL;
|
||||
if (type == FZL_TYPE_OBJECT)
|
||||
classname = decl->var.type->value;
|
||||
|
||||
fzl_symtable_res_t res =
|
||||
fzl_symt_put(analyzer->symbols[analyzer->symbols_top - 1], decl, name,
|
||||
an_toktotype(decl->var.type), 0);
|
||||
fzl_symtable_res_t res = fzl_symt_put(
|
||||
analyzer->symbols[analyzer->symbols_top - 1], decl, name, type, 0);
|
||||
if (res != FZL_SYMTABLE_RESULT_OK)
|
||||
{
|
||||
if (res == FZL_SYMTABLE_RESULT_EXISTS)
|
||||
|
||||
Reference in New Issue
Block a user