Module: wine Branch: master Commit: 353553e0aa716e14ed5788fbc4818ffe23b99eba URL: http://source.winehq.org/git/wine.git/?a=commit;h=353553e0aa716e14ed5788fbc4...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Apr 2 13:45:23 2012 +0200
jscript: Emit undefined statement return for switch without default clausule.
---
dlls/jscript/compile.c | 5 ++++- dlls/jscript/tests/lang.js | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index 1cbe5cb..0a66348 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -1515,8 +1515,11 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t return hres; assert(i == case_cnt);
- if(!have_default) + if(!have_default) { instr_ptr(ctx, default_jmp)->arg1.uint = ctx->code_off; + if(!push_instr(ctx, OP_undefined)) + return E_OUTOFMEMORY; + }
label_set_addr(ctx, stat_ctx.break_label); return S_OK; diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js index 8f5e5d5..41374e2 100644 --- a/dlls/jscript/tests/lang.js +++ b/dlls/jscript/tests/lang.js @@ -719,6 +719,13 @@ case false: } ok(state === "default", "state = " + state);
+switch(1) { +case 2: + ok(false, "unexpected case 2"); +case 3: + ok(false, "unexpected case 3"); +} + tmp = eval("1"); ok(tmp === 1, "eval("1") !== 1"); eval("{ ok(tmp === 1, 'eval: tmp !== 1'); } tmp = 2;");