mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-26 21:58:14 +00:00
Strip semicolon if followed by a } or ) on the same line
This commit is contained in:
@@ -1497,7 +1497,19 @@ void assign_removal_flag_to_semicolon(AstFile *f) {
|
||||
Token *curr_token = &f->tokens[f->curr_token_index];
|
||||
GB_ASSERT(prev_token->kind == Token_Semicolon);
|
||||
if (prev_token->string == ";") {
|
||||
bool ok = false;
|
||||
if (curr_token->pos.line > prev_token->pos.line) {
|
||||
ok = true;
|
||||
} else if (curr_token->pos.line == prev_token->pos.line) {
|
||||
switch (curr_token->kind) {
|
||||
case Token_CloseBrace:
|
||||
case Token_CloseParen:
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
if (build_context.strict_style) {
|
||||
syntax_error(*prev_token, "Found unneeded semicolon");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user