aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-08-08 14:57:25 +0100
committergingerBill <bill@gingerbill.org>2023-08-08 14:57:25 +0100
commitcd74cdfdaf5157704b836c8de1c32b5a03dddcae (patch)
tree39d88a4b0ce0237d303fb1153dfe3c970e819a52 /src
parent49ab935ae9268264fe40177690292ea890f6a7e3 (diff)
Remove `switch in` in favour of `switch _ in`
Diffstat (limited to 'src')
-rw-r--r--src/parser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index bfbd7b32a..a2de85d84 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -4382,7 +4382,10 @@ gb_internal Ast *parse_switch_stmt(AstFile *f) {
f->expr_level = -1;
defer (f->expr_level = prev_level);
- if (allow_token(f, Token_in)) {
+ if (f->curr_token.kind == Token_in) {
+ Token in_token = expect_token(f, Token_in);
+ syntax_error(in_token, "Prefer 'switch _ in' over 'switch in'");
+
auto lhs = array_make<Ast *>(heap_allocator(), 0, 1);
auto rhs = array_make<Ast *>(heap_allocator(), 0, 1);
Token blank_ident = token;