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@gmx.net>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Robert Wilhelm 2020-09-28 20:09:14 +02:00 committed by Alexandre Julliard
parent 723f5f1cc0
commit 53cd1a27ad
2 changed files with 11 additions and 0 deletions

View file

@ -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; }

View file

@ -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")