From: Robert Wilhelm Subject: [PATCH] vbscript: Support property set with parameters. Message-Id: <643d18d202853babedd76588f09556568ee06969.camel@gmx.net> Date: Sat, 21 Nov 2020 10:27:32 +0100 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33996 Signed-off-by: Robert Wilhelm --- 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 560d3b16e69..11d95e57758 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -988,12 +988,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; @@ -1002,7 +997,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; @@ -1014,7 +1009,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 8f1c1307794..034baffa4dd 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -456,7 +456,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 ed89906c9cf..419a4349896 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1772,6 +1772,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 @@ -1790,6 +1801,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 -- 2.26.2