mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-30 18:02:02 +00:00
Simplify expect_semicolon_newline_error rule
This commit is contained in:
@@ -1536,25 +1536,20 @@ bool is_semicolon_optional_for_node(AstFile *f, Ast *s) {
|
||||
}
|
||||
|
||||
void expect_semicolon_newline_error(AstFile *f, Token const &token, Ast *s) {
|
||||
if (build_context.strict_style) {
|
||||
if (f->curr_proc != nullptr && token.string == "\n") {
|
||||
switch (token.kind) {
|
||||
case Token_CloseBrace:
|
||||
case Token_CloseParen:
|
||||
case Token_else:
|
||||
case Token_EOF:
|
||||
return;
|
||||
}
|
||||
if (s != nullptr) {
|
||||
if (is_semicolon_optional_for_node(f, s)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Token tok = token;
|
||||
tok.pos.column -= 1;
|
||||
syntax_error(tok, "Expected ';', got newline");
|
||||
if (build_context.strict_style && token.string == "\n") {
|
||||
switch (token.kind) {
|
||||
case Token_CloseBrace:
|
||||
case Token_CloseParen:
|
||||
case Token_else:
|
||||
return;
|
||||
}
|
||||
if (is_semicolon_optional_for_node(f, s)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Token tok = token;
|
||||
tok.pos.column -= 1;
|
||||
syntax_error(tok, "Expected ';', got newline");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user