jscript: Fixed continue inside for..in statement.

This commit is contained in:
Jacek Caban 2012-01-10 16:10:29 +01:00 committed by Alexandre Julliard
parent 9575b906a4
commit dc5a75a7ac
2 changed files with 24 additions and 7 deletions

View File

@ -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;

View File

@ -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");