Robert Wilhelm : vbscript: Emit catch after enumnext in for each loops.

Alexandre Julliard julliard at winehq.org
Thu Oct 14 15:09:34 CDT 2021


Module: wine
Branch: master
Commit: 56010d0035b316d0906034237627e6f672c6ab4c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=56010d0035b316d0906034237627e6f672c6ab4c

Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date:   Thu Oct 14 19:16:32 2021 +0200

vbscript: Emit catch after enumnext in for each loops.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39463
Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vbscript/compile.c       | 4 ++++
 dlls/vbscript/tests/error.vbs | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c
index da56eac74b2..50c68a6e6b5 100644
--- a/dlls/vbscript/compile.c
+++ b/dlls/vbscript/compile.c
@@ -829,6 +829,10 @@ static HRESULT compile_foreach_statement(compile_ctx_t *ctx, foreach_statement_t
         return hres;
 
     label_set_addr(ctx, loop_ctx.for_end_label);
+
+    if(!emit_catch(ctx, 0))
+        return E_OUTOFMEMORY;
+
     return S_OK;
 }
 
diff --git a/dlls/vbscript/tests/error.vbs b/dlls/vbscript/tests/error.vbs
index 1853f6c4bf5..9b74dc8773e 100644
--- a/dlls/vbscript/tests/error.vbs
+++ b/dlls/vbscript/tests/error.vbs
@@ -309,12 +309,15 @@ call ok(x = "ok", "testOnErrorClear failed")
 sub testForEachError()
     on error resume next
 
-    dim x, y
+    dim x, y, z
     y = false
+    z = false
     for each x in empty
         y = true
     next
+    z = true
     call ok(y, "for each not executed")
+    call ok(z, "line after next not executed")
     call todo_wine_ok(Err.Number = VB_E_OBJNOTCOLLECTION, "Err.Number = " & Err.Number)
 end sub
 




More information about the wine-cvs mailing list