From cd74cdfdaf5157704b836c8de1c32b5a03dddcae Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 8 Aug 2023 14:57:25 +0100 Subject: Remove `switch in` in favour of `switch _ in` --- src/parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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(heap_allocator(), 0, 1); auto rhs = array_make(heap_allocator(), 0, 1); Token blank_ident = token; -- cgit v1.2.3