ref: add type/classname result for each gen_* function

This commit is contained in:
samsonium
2026-11-04 22:25:25 +03:00
parent b278e8bb74
commit aae183c0c0
15 changed files with 204 additions and 108 deletions
+5 -4
View File
@@ -1,13 +1,14 @@
#include <common/fzl_types.h>
#include <compiler/fzl_gen.h>
#include <compiler/internals/gen.h>
#include <stdbool.h>
#include <stdio.h>
// Break keyword
bool gen_break(fzl_gen_t *gen, fzl_node_t *node)
gen_res_t gen_break(fzl_gen_t *gen, fzl_node_t *node)
{
if (!gen || !node)
return false;
return (gen_res_t){.error = true};
fzl_gen_ctx_t *ctx = gen->ctx;
while (ctx != NULL)
@@ -19,7 +20,7 @@ bool gen_break(fzl_gen_t *gen, fzl_node_t *node)
}
if (!ctx || ctx->type != FZL_GEN_CTX_TYPE_LOOP)
return false;
return (gen_res_t){.error = true};
for (size_t i = gen->syms_top - 1; i > ctx->level + 1; i--)
gen_op(gen, FZL_OPCODE_RM_ENVTABLE);
@@ -28,5 +29,5 @@ bool gen_break(fzl_gen_t *gen, fzl_node_t *node)
ctx->loop.breaks[ctx->loop.breaks_count++] = gen->ops_count;
gen_word(gen, 0);
return true;
return (gen_res_t){.error = false, .type = FZL_TYPE_NULL, .classname = NULL};
}