vbscript: Fixed 'exit do' statements crossing for in loops.
This commit is contained in:
parent
b675164be4
commit
8de35a4514
|
@ -682,7 +682,7 @@ static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t
|
|||
|
||||
static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *stat)
|
||||
{
|
||||
statement_ctx_t loop_ctx = {0};
|
||||
statement_ctx_t loop_ctx = {2};
|
||||
unsigned step_instr, instr;
|
||||
BSTR identifier;
|
||||
HRESULT hres;
|
||||
|
@ -743,9 +743,12 @@ static HRESULT compile_forto_statement(compile_ctx_t *ctx, forto_statement_t *st
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
label_set_addr(ctx, loop_ctx.for_end_label);
|
||||
hres = push_instr_uint(ctx, OP_pop, 2);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return push_instr_uint(ctx, OP_pop, 2);
|
||||
label_set_addr(ctx, loop_ctx.for_end_label);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT compile_assignment(compile_ctx_t *ctx, member_expression_t *member_expr, expression_t *value_expr, BOOL is_set)
|
||||
|
|
|
@ -894,10 +894,12 @@ static HRESULT interp_step(exec_ctx_t *ctx)
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(hres == VARCMP_EQ || hres == (gteq_zero ? VARCMP_LT : VARCMP_GT))
|
||||
if(hres == VARCMP_EQ || hres == (gteq_zero ? VARCMP_LT : VARCMP_GT)) {
|
||||
ctx->instr++;
|
||||
else
|
||||
}else {
|
||||
stack_popn(ctx, 2);
|
||||
instr_jmp(ctx, ctx->instr->arg1.uint);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -415,6 +415,12 @@ for x = 1 to 100
|
|||
Call ok(false, "exit for not escaped the loop?")
|
||||
next
|
||||
|
||||
do while true
|
||||
for x = 1 to 100
|
||||
exit do
|
||||
next
|
||||
loop
|
||||
|
||||
Call collectionObj.reset()
|
||||
y = 0
|
||||
x = 10
|
||||
|
|
Loading…
Reference in New Issue