From: Francis De Brabandere <francisdb@gmail.com> --- dlls/vbscript/interp.c | 9 ++++++++- dlls/vbscript/tests/lang.vbs | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 127fcc2c05e..90c5f235ec3 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -707,13 +707,20 @@ static HRESULT interp_icallv(exec_ctx_t *ctx) static HRESULT interp_vcall(exec_ctx_t *ctx) { const unsigned arg_cnt = ctx->instr->arg1.uint; - VARIANT res, *v; + VARIANT res = {0}, *v; HRESULT hres; TRACE("\n"); v = stack_pop(ctx); hres = variant_call(ctx, v, arg_cnt, &res); + if(SUCCEEDED(hres) && V_VT(&res) == (VT_BYREF|VT_VARIANT)) { + VARIANT tmp; + V_VT(&tmp) = VT_EMPTY; + hres = VariantCopyInd(&tmp, &res); + if(SUCCEEDED(hres)) + res = tmp; + } VariantClear(v); if(FAILED(hres)) return hres; diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 0025bfeddcf..1e63b9ad90c 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -1578,6 +1578,25 @@ ok arr2(1,2) = 2, "arr2(1,2) = " & arr2(1,2) x = Array(Array(3)) call ok(x(0)(0) = 3, "x(0)(0) = " & x(0)(0)) +Class ArrayReturnContainer + Public Default Property Get Item(key) + If key = "Key" Then + Item = Array("Value1", Array("SubValue1", "SubValue2")) + End If + End Property +End Class + +Dim containerObj +Set containerObj = New ArrayReturnContainer +call ok(containerObj.Item("Key")(0) = "Value1", "containerObj.Item(Key)(0) = " & containerObj.Item("Key")(0)) +call ok(containerObj.Item("Key")(1)(0) = "SubValue1", "containerObj.Item(Key)(1)(0) = " & containerObj.Item("Key")(1)(0)) +call ok(containerObj.Item("Key")(1)(1) = "SubValue2", "containerObj.Item(Key)(1)(1) = " & containerObj.Item("Key")(1)(1)) +call ok(containerObj("Key")(0) = "Value1", "containerObj(Key)(0) = " & containerObj("Key")(0)) +call ok(containerObj("Key")(1)(0) = "SubValue1", "containerObj(Key)(1)(0) = " & containerObj("Key")(1)(0)) + +call ok(Split("1;2", ";")(0) = "1", "Split(""1;2"", "";"")(0) = " & Split("1;2", ";")(0)) +call ok(Split("1;2", ";")(1) = "2", "Split(""1;2"", "";"")(1) = " & Split("1;2", ";")(1)) + function seta0(arr) arr(0) = 2 seta0 = 1 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10308