vbscript: Allow keywords to be used as property name.

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-11-09 22:09:40 +01:00 committed by Alexandre Julliard
parent b6cc7b5d51
commit 04b43c721a
2 changed files with 16 additions and 3 deletions

View File

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

View File

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