[PATCH] vbscript: Allow keywords to be used as property name.
Robert Wilhelm
robert.wilhelm at gmx.net
Mon Nov 9 15:09:40 CST 2020
Signed-off-by: Robert Wilhelm <robert.wilhelm at gmx.net>
---
dlls/vbscript/parser.y | 6 +++---
dlls/vbscript/tests/lang.vbs | 13 +++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 7c749b5ef77..a9f4c540fcb 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -452,11 +452,11 @@ ClassBody
| PropertyDecl StSep ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; }
PropertyDecl
- : Storage_opt tPROPERTY tGET tIdentifier ArgumentsDecl_opt StSep BodyStatements tEND tPROPERTY
+ : Storage_opt tPROPERTY tGET Identifier ArgumentsDecl_opt StSep BodyStatements tEND tPROPERTY
{ $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $7); CHECK_ERROR; }
- | Storage_opt tPROPERTY tLET tIdentifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY
+ | Storage_opt tPROPERTY tLET Identifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY
{ $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; }
- | Storage_opt tPROPERTY tSET tIdentifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY
+ | Storage_opt tPROPERTY tSET Identifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY
{ $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; }
FunctionDecl
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 570bb7fbcb3..53f36b6e710 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -1656,6 +1656,19 @@ Class class_test_identifiers_as_function_name
End Sub
End Class
+Class class_test_identifiers_as_property_name
+ Public Property Get Property()
+ End Property
+
+ Public Property Let Error(par)
+ Error = par
+ End Property
+
+ Public Property Set Default(par)
+ Set Default = par
+ End Property
+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")
--
2.26.2
More information about the wine-devel
mailing list