Robert Wilhelm : vbscript: Allow keywords to be used as function name.
Alexandre Julliard
julliard at winehq.org
Tue Mar 23 15:07:43 CDT 2021
Module: wine
Branch: oldstable
Commit: 90958b10be2ebe1bba5e3841e6b79f8806e90d89
URL: https://source.winehq.org/git/wine.git/?a=commit;h=90958b10be2ebe1bba5e3841e6b79f8806e90d89
Author: Robert Wilhelm <robert.wilhelm at gmx.net>
Date: Thu Nov 5 23:12:15 2020 +0100
vbscript: Allow keywords to be used as function name.
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 72977a75a4e281dff69f150b608f50a73bb5c81f)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/vbscript/parser.y | 10 +++++-----
dlls/vbscript/tests/lang.vbs | 22 ++++++++++++++++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 20ec89343af..924f6d61c7d 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -486,11 +486,11 @@ ArgumentDecl
/* these keywords may also be an identifier, depending on context */
Identifier
: tIdentifier { $$ = $1; }
- | tDEFAULT { $$ = $1; }
- | tERROR { $$ = $1; }
- | tEXPLICIT { $$ = $1; }
- | tPROPERTY { $$ = $1; }
- | tSTEP { $$ = $1; }
+ | tDEFAULT { ctx->last_token = tIdentifier; $$ = $1; }
+ | tERROR { ctx->last_token = tIdentifier; $$ = $1; }
+ | tEXPLICIT { ctx->last_token = tIdentifier; $$ = $1; }
+ | tPROPERTY { ctx->last_token = tIdentifier; $$ = $1; }
+ | tSTEP { ctx->last_token = tIdentifier; $$ = $1; }
/* Most statements accept both new line and ':' as separators */
StSep
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 2cd4f3ef2f7..7504da16e35 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -1556,9 +1556,31 @@ sub test_identifiers
Dim step
step = "xx"
Call ok(step = "xx", "step = " & step & " expected ""xx""")
+
+ Dim property
+ property = "xx"
+ Call ok(property = "xx", "property = " & property & " expected ""xx""")
end sub
call test_identifiers()
+Class class_test_identifiers_as_function_name
+ Sub Property ( par )
+ End Sub
+
+ Function Error( par )
+ End Function
+
+ Sub Default ()
+ End Sub
+
+ Function Explicit (par)
+ Explicit = par
+ End Function
+
+ Sub Step ( default )
+ End Sub
+End Class
+
sub test_dotIdentifiers
' test keywords that can also be an identifier after a dot
Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10")
More information about the wine-cvs
mailing list