[PATCH] vbscript: Handle recursive call.
Robert Wilhelm
robert.wilhelm at gmx.net
Fri Sep 24 11:02:53 CDT 2021
Hi Jacek,
thank you for the review and the testcase.
It seems it cannot be solved in interpreter alone, because bytecode for y=f and y=f() is same in following example.
I would be glad on advice how to fix this...
Thanks,
Robert
function f
y = f ' y =Empty
y = f() ' recursive call
end function
call f()
00f4:trace:vbscript_disas:dump_code 1: icallv L"f" 0
00f4:trace:vbscript_disas:dump_code 2: catch 2 0
00f4:trace:vbscript_disas:dump_code 3: ret
00f4:trace:vbscript_disas:dump_code 4: icall L"f" 0
00f4:trace:vbscript_disas:dump_code 5: assign_ident L"y" 0
00f4:trace:vbscript_disas:dump_code 6: catch 6 0
00f4:trace:vbscript_disas:dump_code 7: icall L"f" 0
00f4:trace:vbscript_disas:dump_code 8: assign_ident L"y" 0
00f4:trace:vbscript_disas:dump_code 9: catch 9 0
00f4:trace:vbscript_disas:dump_code 10: ret
On Thu, 2021-09-23 at 14:39 +0200, Jacek Caban wrote:
> Hi Robert,
>
> Sorry for the delay.
>
> On 9/16/21 10:25 PM, Robert Wilhelm wrote:
> > if((ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET)
> > - && !wcsicmp(name, ctx->func->name)) {
> > + && !wcsicmp(name, ctx->func->name)
> > + /* you must not use return value for recursive call */
> > + && ((invoke_type != VBDISP_CALLGET) || ((invoke_type == VBDISP_CALLGET) && ( V_VT(&ctx->ret_val) == VT_DISPATCH)))) {
>
>
> I experimented a bit with this, see attached test. It seems that we
> should use the current function even if ret_val is modified and not an
> object.
>
>
> Thanks,
>
> Jacek
>
More information about the wine-devel
mailing list