diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-24 12:14:48 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-24 12:14:48 +0000 |
| commit | 812fe9cbe124bf39a06f58a538c8c01f7402fb09 (patch) | |
| tree | 8ea1f8258714e7dd8916eb221006e45082a129bb /src/parser/parser_stmt.c | |
| parent | 22035400ed7b7fcda088a1a5b1ca6505b23bf63f (diff) | |
Fix for #110
Diffstat (limited to 'src/parser/parser_stmt.c')
| -rw-r--r-- | src/parser/parser_stmt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 73ae249..325fa1c 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -917,8 +917,8 @@ ASTNode *parse_while(ParserContext *ctx, Lexer *l) check_assignment_condition(cond); // Zen: While(true) - if ((cond->type == NODE_EXPR_LITERAL && cond->literal.type_kind == TOK_INT && - strcmp(cond->literal.string_val, "1") == 0) || + if ((cond->type == NODE_EXPR_LITERAL && cond->literal.type_kind == LITERAL_INT && + cond->literal.int_val == 1) || (cond->type == NODE_EXPR_VAR && strcmp(cond->var_ref.name, "true") == 0)) { zen_trigger_at(TRIGGER_WHILE_TRUE, cond->token); @@ -1060,7 +1060,7 @@ ASTNode *parse_for(ParserContext *ctx, Lexer *l) // while(true) ASTNode *while_loop = ast_create(NODE_WHILE); ASTNode *true_lit = ast_create(NODE_EXPR_LITERAL); - true_lit->literal.type_kind = TOK_INT; // Treated as bool in conditions + true_lit->literal.type_kind = LITERAL_INT; // Treated as bool in conditions true_lit->literal.int_val = 1; true_lit->literal.string_val = xstrdup("1"); while_loop->while_stmt.condition = true_lit; @@ -1203,7 +1203,7 @@ ASTNode *parse_for(ParserContext *ctx, Lexer *l) { // Empty condition = true ASTNode *true_lit = ast_create(NODE_EXPR_LITERAL); - true_lit->literal.type_kind = 0; + true_lit->literal.type_kind = LITERAL_INT; true_lit->literal.int_val = 1; cond = true_lit; } |
