From: kramm Date: Fri, 2 Jan 2009 19:51:50 +0000 (+0000) Subject: refined switch fallthrough handling X-Git-Tag: release-0-9-0~455 X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=b6e6c740cee6ebf4f2e2337492dda11ff989c5fc;hp=d9fc7aab1efc946d04f0e8cde52c88ffd4598943;p=swftools.git refined switch fallthrough handling --- 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) {