mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 19:30:06 +00:00
Fix checking if a procedure terminates for for loops.
This commit is contained in:
+2
-4
@@ -125,15 +125,13 @@ bool check_is_terminating(AstNode *node) {
|
|||||||
case_end;
|
case_end;
|
||||||
|
|
||||||
case_ast_node(fs, ForStmt, node);
|
case_ast_node(fs, ForStmt, node);
|
||||||
if (!check_has_break(fs->body, true)) {
|
if (fs->cond == NULL && !check_has_break(fs->body, true)) {
|
||||||
return check_is_terminating(fs->body);
|
return check_is_terminating(fs->body);
|
||||||
}
|
}
|
||||||
case_end;
|
case_end;
|
||||||
|
|
||||||
case_ast_node(rs, RangeStmt, node);
|
case_ast_node(rs, RangeStmt, node);
|
||||||
if (!check_has_break(rs->body, true)) {
|
return false;
|
||||||
return check_is_terminating(rs->body);
|
|
||||||
}
|
|
||||||
case_end;
|
case_end;
|
||||||
|
|
||||||
case_ast_node(ms, MatchStmt, node);
|
case_ast_node(ms, MatchStmt, node);
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ typedef enum ParseFileError {
|
|||||||
|
|
||||||
typedef Array(AstNode *) AstNodeArray;
|
typedef Array(AstNode *) AstNodeArray;
|
||||||
|
|
||||||
|
gb_global i32 global_file_id = 0;
|
||||||
|
|
||||||
typedef struct AstFile {
|
typedef struct AstFile {
|
||||||
i32 id;
|
i32 id;
|
||||||
gbArena arena;
|
gbArena arena;
|
||||||
@@ -3639,6 +3641,7 @@ ParseFileError init_ast_file(AstFile *f, String fullpath) {
|
|||||||
gb_arena_init_from_allocator(&f->arena, heap_allocator(), arena_size);
|
gb_arena_init_from_allocator(&f->arena, heap_allocator(), arena_size);
|
||||||
|
|
||||||
f->curr_proc = NULL;
|
f->curr_proc = NULL;
|
||||||
|
f->id = ++global_file_id;
|
||||||
|
|
||||||
return ParseFile_None;
|
return ParseFile_None;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user