aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2025-06-09 17:19:58 +0100
committergingerBill <bill@gingerbill.org>2025-06-09 17:19:58 +0100
commit002b50360c7fd9a5ac62816e634c1bd73277f90d (patch)
tree3437f8efab2ee300bdf9fffe17aead4365e21336 /src/check_stmt.cpp
parent2ffd6be20a50f1f9146af3c12c5adf8cf3d2e095 (diff)
parent4a675395c5c65199046b5aefbe8528f5969d633e (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 6cacef3ee..d92edf41d 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1593,6 +1593,20 @@ gb_internal void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_
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");
+ }
+ }
+ }
}
gb_internal void check_block_stmt_for_errors(CheckerContext *ctx, Ast *body) {