#include #include #include // Analyze unary condition fzl_an_res_t analyze_unarycond(fzl_analyzer_t *analyzer, fzl_node_t *unary) { if (!analyzer) return (fzl_an_res_t){.error = true}; if (!unary || unary->type != FZL_NODETYPE_NOT) { an_push_error(analyzer, NULL, "node is not an unary condition operator"); return (fzl_an_res_t){.error = true}; } fzl_an_res_t operand_res = analyze_common(analyzer, unary->unary_op.operand); if (operand_res.error) return (fzl_an_res_t){.error = true}; if (operand_res.type != FZL_TYPE_BOOL && operand_res.type < FZL_TYPE_INT8) { an_push_error(analyzer, unary->unary_op.operand->token, "unary condition only support bool and integer types"); return (fzl_an_res_t){.error = true}; } return (fzl_an_res_t){ .error = false, .type = FZL_TYPE_BOOL, .classname = NULL}; }