Module: wine Branch: oldstable Commit: be8ffcef055071315a0771fcd7c9106759bece3d URL: https://source.winehq.org/git/wine.git/?a=commit;h=be8ffcef055071315a0771fcd... Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Sat Nov 21 10:27:32 2020 +0100 vbscript: Support property set with parameters. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33996 Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit c39cd37383f402286c79a58e064adb98c0e7c6dc) Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org> --- dlls/vbscript/interp.c | 11 +++-------- dlls/vbscript/parser.y | 2 +- dlls/vbscript/tests/lang.vbs | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index a3d37d23dd5..9723d332d0e 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -963,12 +963,7 @@ static HRESULT interp_set_member(exec_ctx_t *ctx) TRACE("%s\n", debugstr_w(identifier)); - if(arg_cnt) { - FIXME("arguments not supported\n"); - return E_NOTIMPL; - } - - hres = stack_assume_disp(ctx, 1, &obj); + hres = stack_assume_disp(ctx, arg_cnt+1, &obj); if(FAILED(hres)) return hres; @@ -977,7 +972,7 @@ static HRESULT interp_set_member(exec_ctx_t *ctx) return E_FAIL; } - hres = stack_assume_disp(ctx, 0, NULL); + hres = stack_assume_disp(ctx, arg_cnt, NULL); if(FAILED(hres)) return hres; @@ -989,7 +984,7 @@ static HRESULT interp_set_member(exec_ctx_t *ctx) if(FAILED(hres)) return hres; - stack_popn(ctx, 2); + stack_popn(ctx, arg_cnt+2); return S_OK; } diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 390a42f7fad..b4ec921a188 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -452,7 +452,7 @@ PropertyDecl { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $7); CHECK_ERROR; } | Storage_opt tPROPERTY tLET Identifier '(' ArgumentDeclList ')' StSep BodyStatements tEND tPROPERTY { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } - | Storage_opt tPROPERTY tSET Identifier '(' ArgumentDecl ')' StSep BodyStatements tEND tPROPERTY + | Storage_opt tPROPERTY tSET Identifier '(' ArgumentDeclList ')' 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 dd6012bbd35..1ab3b6274e6 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1697,6 +1697,17 @@ end class Class TestPropParam Public oDict + Public gotNothing + Public m_obj + + Public Property Set bar(obj) + Set m_obj = obj + End Property + Public Property Set foo(par,obj) + Set m_obj = obj + if obj is Nothing Then gotNothing = True + oDict = par + End Property Public Property Let Key(oldKey,newKey) oDict = oldKey & newKey End Property @@ -1715,6 +1726,11 @@ x.three(1,2) = 3 call ok(x.oDict = "123","x.oDict = " & x.oDict & " expected 123") x.ten(1,2,3,4,5,6,7,8,9) = 0 call ok(x.oDict = "1234567890","x.oDict = " & x.oDict & " expected 1234567890") +Set x.bar = Nothing +call ok(x.gotNothing=Empty,"x.gotNothing = " & x.gotNothing & " expected Empty") +Set x.foo("123") = Nothing +call ok(x.oDict = "123","x.oDict = " & x.oDict & " expected 123") +call ok(x.gotNothing=True,"x.gotNothing = " & x.gotNothing & " expected true") set x = new TestPropSyntax set x.prop = new TestPropSyntax