jscript: Fixed continue inside for..in statement.
This commit is contained in:
parent
9575b906a4
commit
dc5a75a7ac
|
@ -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)
|
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;
|
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))
|
if(iter->using_scope && !push_instr(ctx, OP_pop_scope))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
if(iter->using_except && !push_instr(ctx, OP_pop_except))
|
if(iter->using_except && !push_instr(ctx, OP_pop_except))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
stack_pop += iter->stack_use;
|
stack_pop += iter->stack_use;
|
||||||
if(iter == stat_ctx)
|
|
||||||
break;
|
|
||||||
iter = iter->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: optimize */
|
/* FIXME: optimize */
|
||||||
|
@ -1308,7 +1305,7 @@ static HRESULT compile_break_statement(compiler_ctx_t *ctx, branch_statement_t *
|
||||||
if(stat->identifier)
|
if(stat->identifier)
|
||||||
return push_instr(ctx, OP_label) ? S_OK : E_OUTOFMEMORY; /* FIXME */
|
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))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
|
|
@ -839,8 +839,8 @@ for(tmp in obj1.nonexistent)
|
||||||
ok(false, "for(tmp in obj1.nonexistent) called with tmp = " + tmp);
|
ok(false, "for(tmp in obj1.nonexistent) called with tmp = " + tmp);
|
||||||
ok(!("nonexistent" in obj1), "nonexistent added to obj1 by for..in loop");
|
ok(!("nonexistent" in obj1), "nonexistent added to obj1 by for..in loop");
|
||||||
|
|
||||||
var i, j;
|
|
||||||
|
|
||||||
|
var i, j;
|
||||||
|
|
||||||
tmp = "";
|
tmp = "";
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -896,6 +896,26 @@ for(j in [1,2,3]) {
|
||||||
}
|
}
|
||||||
ok(tmp === "1234", "tmp = " + tmp);
|
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");
|
ok((void 1) === undefined, "(void 1) !== undefined");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue