mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix Compiler does not complain about missing semicolon #433
This commit is contained in:
+10
-5
@@ -1370,10 +1370,6 @@ void expect_semicolon(AstFile *f, Ast *s) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (f->curr_token.kind) {
|
|
||||||
case Token_EOF:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
if (prev_token.pos.line != f->curr_token.pos.line) {
|
if (prev_token.pos.line != f->curr_token.pos.line) {
|
||||||
@@ -1386,12 +1382,21 @@ void expect_semicolon(AstFile *f, Ast *s) {
|
|||||||
case Token_CloseParen:
|
case Token_CloseParen:
|
||||||
case Token_else:
|
case Token_else:
|
||||||
return;
|
return;
|
||||||
|
case Token_EOF:
|
||||||
|
if (is_semicolon_optional_for_node(f, s)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String node_string = ast_strings[s->kind];
|
String node_string = ast_strings[s->kind];
|
||||||
syntax_error(prev_token, "Expected ';' after %.*s, got %.*s",
|
syntax_error(prev_token, "Expected ';' after %.*s, got %.*s",
|
||||||
LIT(node_string), LIT(token_strings[prev_token.kind]));
|
LIT(node_string), LIT(token_strings[f->curr_token.kind]));
|
||||||
} else {
|
} else {
|
||||||
|
switch (f->curr_token.kind) {
|
||||||
|
case Token_EOF:
|
||||||
|
return;
|
||||||
|
}
|
||||||
syntax_error(prev_token, "Expected ';'");
|
syntax_error(prev_token, "Expected ';'");
|
||||||
}
|
}
|
||||||
fix_advance_to_next_stmt(f);
|
fix_advance_to_next_stmt(f);
|
||||||
|
|||||||
Reference in New Issue
Block a user