fix: sanitizer checks fix (iteration 2)

This commit is contained in:
samsonium
2026-10-19 19:54:11 +03:00
parent 1289f6c150
commit 3f2f03f931
2 changed files with 30 additions and 9 deletions
+26 -8
View File
@@ -14,11 +14,19 @@ fzl_token_t null_tok = {
.filename = "",
.ln = 0,
.cn = 0,
.store_value = true,
.store_value = false,
.value = "null",
.value_sz = 4,
};
fzl_token_t this_tok = {.type = FZL_TOKTYPE_NAME,
.filename = "",
.ln = 0,
.cn = 0,
.store_value = false,
.value = "this",
.value_sz = 4};
fzl_parser_t *fzl_mkparser(fzl_reader_ll_t *first)
{
if (!first)
@@ -725,10 +733,7 @@ fzl_node_t *parse_class(fzl_parser_t *parser)
memmove(&new_args[1], new_args,
(node->fn.args_count - 1) * sizeof(fzl_node_t *));
fzl_token_t *this_tok =
fzl_mktoken(FZL_TOKTYPE_NAME, node->fn.name->ln, node->fn.name->cn,
"this", 4, node->fn.name->filename);
fzl_node_t *this_id = fzl_mknode(FZL_NODETYPE_IDENTIFIER, this_tok);
fzl_node_t *this_id = fzl_mknode(FZL_NODETYPE_IDENTIFIER, &this_tok);
fzl_node_t *this_dec = fzl_mknode(FZL_NODETYPE_DECLARATION, name);
this_dec->var.type = name;
this_dec->var.identifier = this_id;
@@ -1090,14 +1095,28 @@ void fzl_freeast(fzl_node_t *root)
break;
case FZL_NODETYPE_CALL:
if (root->call.callee)
fzl_freeast(root->call.callee);
if (root->call.args_count)
{
for (size_t i = 0; i < root->call.args_count; i++)
if (root->call.args[i])
fzl_freeast(root->call.args[i]);
free(root->call.args);
}
if (root->call.args)
free(root->call.args);
break;
case FZL_NODETYPE_CONDITIONAL:
if (root->cond.condition)
fzl_freeast(root->cond.condition);
if (root->cond.true_block)
fzl_freeast(root->cond.true_block);
if (root->cond.else_block)
fzl_freeast(root->cond.else_block);
break;
case FZL_NODETYPE_ADD:
@@ -1106,7 +1125,6 @@ void fzl_freeast(fzl_node_t *root)
case FZL_NODETYPE_DIV:
case FZL_NODETYPE_POW:
case FZL_NODETYPE_MOD:
case FZL_NODETYPE_CONDITIONAL:
case FZL_NODETYPE_OR:
case FZL_NODETYPE_AND:
case FZL_NODETYPE_EQUAL: