Robert Wilhelm : vbscript: Fix vanishing statements.
Alexandre Julliard
julliard at winehq.org
Tue Mar 23 15:07:41 CDT 2021
Module: wine
Branch: oldstable
Commit: 25491ebd2ac2fc5f0f1eff5f7211c8c493e23c7b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=25491ebd2ac2fc5f0f1eff5f7211c8c493e23c7b
Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date: Tue Sep 22 22:14:29 2020 +0200
vbscript: Fix vanishing statements.
When adding multiple statements (e.g. colon separated SimpleStatements)
in function source_add_statement(), tail of linked list was not adjusted.
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>
(cherry picked from commit fe59d1a5d35f4d0d9e2a262c25cbfefb91cdad3c)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/vbscript/parser.y | 5 +++++
dlls/vbscript/tests/lang.vbs | 3 +++
2 files changed, 8 insertions(+)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 9a395f94961..9507e97e8ca 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -511,12 +511,17 @@ static void source_add_statement(parser_ctx_t *ctx, statement_t *stat)
if(!stat)
return;
+ /* concatenate both linked lists */
if(ctx->stats) {
ctx->stats_tail->next = stat;
ctx->stats_tail = stat;
}else {
ctx->stats = ctx->stats_tail = stat;
}
+ /* find new tail */
+ while(ctx->stats_tail->next) {
+ ctx->stats_tail=ctx->stats_tail->next;
+ }
}
static void source_add_class(parser_ctx_t *ctx, class_decl_t *class_decl)
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 95988a4e1d9..14761cf5a52 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -62,6 +62,9 @@ Call ok(W = 5, "W = " & W & " expected " & 5)
x = "xx"
Call ok(x = "xx", "x = " & x & " expected ""xx""")
+Dim public1 : public1 = 42
+Call ok(public1 = 42, "public1=" & public1 & " expected & " & 42)
+
Call ok(true <> false, "true <> false is false")
Call ok(not (true <> true), "true <> true is true")
Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
More information about the wine-cvs
mailing list