[PATCH V2] vbscript: fix vanishing statements.
Robert Wilhelm
robert.wilhelm at gmx.net
Tue Sep 22 15:14:29 CDT 2020
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>
---
v2: in first mail the patch vanished...
---
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 80f8699bd8..924d0b973b 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -516,12 +516,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 621b390523..9f254f502b 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -67,6 +67,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")
--
2.26.2
More information about the wine-devel
mailing list