Jacek Caban : jscript: Fixed continue inside for..in statement.
Alexandre Julliard
julliard at winehq.org
Tue Jan 10 13:11:20 CST 2012
Module: wine
Branch: master
Commit: dc5a75a7ace93c159290e193d01f1aa88feb2224
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dc5a75a7ace93c159290e193d01f1aa88feb2224
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jan 10 16:10:29 2012 +0100
jscript: Fixed continue inside for..in statement.
---
dlls/jscript/compile.c | 9 +++------
dlls/jscript/tests/lang.js | 22 +++++++++++++++++++++-
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 4cdd2ed..19fd0c2 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -1237,18 +1237,15 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s
static HRESULT pop_to_stat(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx)
{
- statement_ctx_t *iter = ctx->stat_ctx;
unsigned stack_pop = 0;
+ statement_ctx_t *iter;
- while(iter) {
+ for(iter = ctx->stat_ctx; iter != stat_ctx; iter = iter->next) {
if(iter->using_scope && !push_instr(ctx, OP_pop_scope))
return E_OUTOFMEMORY;
if(iter->using_except && !push_instr(ctx, OP_pop_except))
return E_OUTOFMEMORY;
stack_pop += iter->stack_use;
- if(iter == stat_ctx)
- break;
- iter = iter->next;
}
/* FIXME: optimize */
@@ -1308,7 +1305,7 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
if(stat->identifier)
return push_instr(ctx, OP_label) ? S_OK : E_OUTOFMEMORY; /* FIXME */
- hres = pop_to_stat(ctx, pop_ctx);
+ hres = pop_to_stat(ctx, pop_ctx->next);
if(FAILED(hres))
return hres;
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index d7182c6..58d4599 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -839,8 +839,8 @@ for(tmp in obj1.nonexistent)
ok(false, "for(tmp in obj1.nonexistent) called with tmp = " + tmp);
ok(!("nonexistent" in obj1), "nonexistent added to obj1 by for..in loop");
-var i, j;
+var i, j;
tmp = "";
i = 0;
@@ -896,6 +896,26 @@ for(j in [1,2,3]) {
}
ok(tmp === "1234", "tmp = " + tmp);
+tmp = 0;
+for(var iter in [1,2,3]) {
+ tmp += +iter;
+ continue;
+}
+ok(tmp === 3, "tmp = " + tmp);
+
+tmp = false;
+for(var iter in [1,2,3]) {
+ switch(+iter) {
+ case 1:
+ tmp = true;
+ try {
+ continue;
+ }finally {}
+ default:
+ continue;
+ }
+}
+ok(tmp, "tmp = " + tmp);
ok((void 1) === undefined, "(void 1) !== undefined");
More information about the wine-cvs
mailing list