mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 04:50:29 +00:00
-strict-style: enforce case to be in the same column as switch
This commit is contained in:
@@ -1258,6 +1258,20 @@ gb_internal void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags
|
||||
error_line("\tSuggestion: Was '#partial switch' wanted?\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (build_context.strict_style) {
|
||||
Token stok = ss->token;
|
||||
for_array(i, bs->stmts) {
|
||||
Ast *stmt = bs->stmts[i];
|
||||
if (stmt->kind != Ast_CaseClause) {
|
||||
continue;
|
||||
}
|
||||
Token ctok = stmt->CaseClause.token;
|
||||
if (ctok.pos.column > stok.pos.column) {
|
||||
error(ctok, "With '-strict-style', 'case' statements must share the same column as the 'switch' token");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user