mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-20 04:08:26 +00:00
jscript: Fixed empty cases in the end of switch statement.
This commit is contained in:
parent
a1e6835d0e
commit
6ba7a1964a
|
@ -1540,18 +1540,26 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
|
|||
|
||||
set_arg_uint(ctx, iter->expr ? case_jmps[i++] : default_jmp, ctx->code_off);
|
||||
|
||||
for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); stat_iter = stat_iter->next) {
|
||||
hres = compile_statement(ctx, &stat_ctx, stat_iter);
|
||||
if(iter->stat) {
|
||||
for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter);
|
||||
stat_iter = stat_iter->next) {
|
||||
hres = compile_statement(ctx, &stat_ctx, stat_iter);
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
if(stat_iter->next && !push_instr(ctx, OP_pop)) {
|
||||
hres = E_OUTOFMEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
|
||||
if(stat_iter->next && !push_instr(ctx, OP_pop)) {
|
||||
}else {
|
||||
if(!push_instr(ctx, OP_undefined)) {
|
||||
hres = E_OUTOFMEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(FAILED(hres))
|
||||
break;
|
||||
}
|
||||
|
||||
heap_free(case_jmps);
|
||||
|
|
|
@ -757,6 +757,32 @@ case 3:
|
|||
ok(false, "unexpected case 3");
|
||||
}
|
||||
|
||||
switch(1) {
|
||||
case 2:
|
||||
ok(false, "unexpected case 2");
|
||||
break;
|
||||
default:
|
||||
/* empty default */
|
||||
}
|
||||
|
||||
switch(2) {
|
||||
default:
|
||||
ok(false, "unexpected default");
|
||||
break;
|
||||
case 2:
|
||||
/* empty case */
|
||||
};
|
||||
|
||||
switch(2) {
|
||||
default:
|
||||
ok(false, "unexpected default");
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
/* empty case */
|
||||
};
|
||||
|
||||
(function() {
|
||||
var i=0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue