Jacek Caban : vbscript: Fixed 'exit do' statements crossing for in loops.
Alexandre Julliard
julliard at winehq.org
Mon Jul 9 14:56:35 CDT 2012
Module: wine
Branch: master
Commit: 8de35a45143c48d80b522441558f1a1b2fdaa174
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8de35a45143c48d80b522441558f1a1b2fdaa174
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jul 3 19:17:23 2012 +0200
vbscript: Fixed 'exit do' statements crossing for in loops.
---
dlls/vbscript/compile.c | 9 ++++++---
dlls/vbscript/interp.c | 6 ++++--
dlls/vbscript/tests/lang.vbs | 6 ++++++
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index e93b257..68e0a70 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -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)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c
index 9a8f97e..3a6fb38 100644
--- a/dlls/vbscript/interp.c
+++ b/dlls/vbscript/interp.c
@@ -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;
}
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 1636de1..f203e83 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -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
More information about the wine-cvs
mailing list