diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 6bd4907c125..c5d1c59157b 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -403,8 +403,8 @@ ClassBody | PropertyDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } PropertyDecl - : Storage_opt tPROPERTY tGET tIdentifier EmptyBrackets_opt tNL StatementsNl_opt tEND tPROPERTY - { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, NULL, $7); CHECK_ERROR; } + : Storage_opt tPROPERTY tGET tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tPROPERTY + { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $7); CHECK_ERROR; } | Storage_opt tPROPERTY tLET tIdentifier '(' ArgumentDecl ')' tNL StatementsNl_opt tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } | Storage_opt tPROPERTY tSET tIdentifier '(' ArgumentDecl ')' tNL StatementsNl_opt tEND tPROPERTY diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index d3e83183b50..c24ffa6d7b6 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -849,6 +849,10 @@ Class TestClass Call ok(getVT(publicProp2) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2)) Call ok(getVT(Me.publicProp2) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2)) End Sub + + Property Get gsGetProp(x) + gsGetProp = x + End Property End Class Call testDisp(new testClass) @@ -916,6 +920,29 @@ Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled) Call (New testclass).publicSub() Call (New testclass).publicSub +class PropTest + property get prop0() + prop0 = 1 + end property + + property get prop1(x) + prop1 = x+1 + end property + + property get prop2(x, y) + prop2 = x+y + end property +end class + +set obj = new PropTest + +call ok(obj.prop0 = 1, "obj.prop0 = " & obj.prop0) +call ok(obj.prop1(3) = 4, "obj.prop1(3) = " & obj.prop1(3)) +call ok(obj.prop2(3,4) = 7, "obj.prop2(3,4) = " & obj.prop2(3,4)) +call obj.prop0() +call obj.prop1(2) +call obj.prop2(3,4) + x = "following ':' is correct syntax" : x = "following ':' is correct syntax" :: : :: x = "also correct syntax"