From b6e6c740cee6ebf4f2e2337492dda11ff989c5fc Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 2 Jan 2009 19:51:50 +0000 Subject: [PATCH] refined switch fallthrough handling --- lib/as3/parser.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 8c99eca..264d2c7 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -1399,7 +1399,9 @@ CASE: "case" CONSTANT ':' MAYBECODE { $$ = code_append($$, $2.c); code_t*j = $$ = abc_ifne($$, 0); $$ = code_append($$, $4); - $$ = abc___continue__($$, ""); + if($$->opcode != OPCODE___BREAK__) { + $$ = abc___fallthrough__($$, ""); + } code_t*e = $$ = abc_nop($$); j->branch = e; } @@ -1415,6 +1417,7 @@ SWITCH : T_SWITCH '(' {new_state();} E ')' '{' MAYBE_CASE_LIST '}' { code_t*c = $$,*lastblock=0; while(c) { if(c->opcode == OPCODE_IFNE) { + if(!c->next) syntaxerror("internal error in fallthrough handling"); lastblock=c->next; } else if(c->opcode == OPCODE___CONTINUE__) { if(lastblock) { -- 1.7.10.4