feat: add prepared error/null ok returns from gen_* functions

This commit is contained in:
samsonium
2026-11-04 22:52:40 +03:00
parent aae183c0c0
commit 181458ecda
18 changed files with 232 additions and 66 deletions
@@ -0,0 +1,23 @@
#include <common/fzl_opcodes.h>
#include <common/fzl_types.h>
#include <compiler/fzl_parser.h>
#include <compiler/internals/gen.h>
#include <stdio.h>
// Currently, only NOT operator
gen_res_t gen_unary_logical(fzl_gen_t *gen, fzl_node_t *node)
{
if (!gen || !node)
return gen_error;
gen_res_t operand_res = gen_common(gen, node->unary_op.operand);
if (operand_res.error)
return gen_error;
if (node->type == FZL_NODETYPE_NOT)
gen_op(gen, FZL_OPCODE_NOT);
else
return gen_error;
return (gen_res_t){.error = false, .type = FZL_TYPE_BOOL, .classname = NULL};
}