From e473fe7f050ab050c096f108fcceff3e89d582ee Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 19 May 2025 14:06:20 +0800 Subject: [PATCH] fix a bug --- src/compiler/compiler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index 53e4fd03..c2189c09 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -2061,14 +2061,14 @@ static Error* compile_match_case(Compiler* self, c11_vector* patches) { int break_patch = Ctx__emit_(ctx(), OP_JUMP_FORWARD, BC_NOARG, prev()->line); c11_vector__push(int, patches, break_patch); } + } else { + return SyntaxError(self, "expected 'case', got '%s'", TokenSymbols[curr()->type]); } match_newlines(); } consume(TK_DEDENT); - if(patches->length == 0) return SyntaxError(self, "invalid syntax"); - for(int i = 0; i < patches->length; i++) { int patch = c11__getitem(int, patches, i); Ctx__patch_jump(ctx(), patch);