jscript: Make sure to jump out of switch before entering implicit default clausule.

This commit is contained in:
Jacek Caban 2012-04-16 11:25:25 +02:00 committed by Alexandre Julliard
parent af5c45aac0
commit 05d59abc1c
2 changed files with 13 additions and 0 deletions

View File

@ -1516,6 +1516,9 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
assert(i == case_cnt);
if(!have_default) {
hres = push_instr_uint(ctx, OP_jmp, stat_ctx.break_label);
if(FAILED(hres))
return hres;
instr_ptr(ctx, default_jmp)->arg1.uint = ctx->code_off;
if(!push_instr(ctx, OP_undefined))
return E_OUTOFMEMORY;

View File

@ -726,6 +726,16 @@ case 3:
ok(false, "unexpected case 3");
}
(function() {
var i=0;
switch(1) {
case 1:
i++;
}
return i;
})();
tmp = eval("1");
ok(tmp === 1, "eval(\"1\") !== 1");
eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");