Robert Wilhelm : vbscript: Allow public and private declarations in global scope.

Alexandre Julliard julliard at winehq.org
Mon Sep 28 14:49:27 CDT 2020


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

Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date:   Mon Sep 28 20:09:14 2020 +0200

vbscript: Allow public and private declarations in global scope.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46588
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/parser.y       | 7 +++++++
 dlls/vbscript/tests/lang.vbs | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 924d0b973b..cf94bdce46 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -131,6 +131,7 @@ static statement_t *link_statements(statement_t*,statement_t*);
 %token <dbl> tDouble
 
 %type <statement> Statement SimpleStatement StatementNl StatementsNl StatementsNl_opt BodyStatements IfStatement Else_opt
+%type <statement> GlobalDimDeclaration
 %type <expression> Expression LiteralExpression PrimaryExpression EqualityExpression CallExpression ExpressionNl_opt
 %type <expression> ConcatExpression AdditiveExpression ModExpression IntdivExpression MultiplicativeExpression ExpExpression
 %type <expression> NotExpression UnaryExpression AndExpression OrExpression XorExpression EqvExpression SignExpression
@@ -161,9 +162,15 @@ OptionExplicit_opt
 
 SourceElements
     : /* empty */
+    | SourceElements GlobalDimDeclaration StSep
+                                            { source_add_statement(ctx, $2); }
     | SourceElements StatementNl            { source_add_statement(ctx, $2); }
     | SourceElements ClassDeclaration       { source_add_class(ctx, $2); }
 
+GlobalDimDeclaration
+    : tPRIVATE DimDeclList                  { $$ = new_dim_statement(ctx, @$, $2); CHECK_ERROR; }
+    | tPUBLIC  DimDeclList                  { $$ = new_dim_statement(ctx, @$, $2); CHECK_ERROR; }
+
 ExpressionNl_opt
     : /* empty */                           { $$ = NULL; }
     | Expression tNL                        { $$ = $1; }
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 9f254f502b..dc16c50fae 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -69,6 +69,10 @@ Call ok(x = "xx", "x = " & x & " expected ""xx""")
 
 Dim public1 : public1 = 42
 Call ok(public1 = 42, "public1=" & public1 & " expected & " & 42)
+Private priv1 : priv1 = 43
+Call ok(priv1 = 43, "priv1=" & priv1 & " expected & " & 43)
+Public pub1 : pub1 = 44
+Call ok(pub1 = 44, "pub1=" & pub1 & " expected & " & 44)
 
 Call ok(true <> false, "true <> false is false")
 Call ok(not (true <> true), "true <> true is true")




More information about the wine-cvs mailing list