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

Alexandre Julliard julliard at winehq.org
Mon Apr 16 13:35:45 CDT 2012


Module: wine
Branch: master
Commit: 05d59abc1c7a0463a90fc121252b0e342a3609d1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=05d59abc1c7a0463a90fc121252b0e342a3609d1

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Apr 16 11:25:25 2012 +0200

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

---

 dlls/jscript/compile.c     |    3 +++
 dlls/jscript/tests/lang.js |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 0a66348..b14c50b 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -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;
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 41374e2..4d2efa3 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -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;");




More information about the wine-cvs mailing list