0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.1.0673: Vim9: too recursive func calls when calling super-class method

Problem:  Vim9: too recursive func calls when calling super-class method
          with non-overriden super-call methods. (Aliaksei Budavei)
Solution: use interface method, when super is to be used (Ernie Rael)

When compiling "super.Func()" force class context to class that defines
function that is doing "super.Func()".
ISN_METHODCALL arg "cmf_is_super" for specific ufunc.

fixes: #15448
fixes: #15463 (2) super.method may not execute in context of defining
                  class
closes: #15477

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael
2024-08-13 23:27:22 +02:00
committed by Christian Brabandt
parent d33afe12c6
commit 58c9579430
7 changed files with 171 additions and 15 deletions

View File

@@ -1805,6 +1805,8 @@ generate_BLOBAPPEND(cctx_T *cctx)
* Generate an ISN_DCALL, ISN_UCALL or ISN_METHODCALL instruction.
* When calling a method on an object, of which we know the interface only,
* then "cl" is the interface and "mi" the method index on the interface.
* save is_super in the "isn->isn_arg"; it flags execution to use mfunc
* directly to determine ufunc.
* Return FAIL if the number of arguments is wrong.
*/
int
@@ -1813,7 +1815,8 @@ generate_CALL(
ufunc_T *ufunc,
class_T *cl,
int mi,
int pushed_argcount)
int pushed_argcount,
int is_super)
{
isn_T *isn;
int regular_args = ufunc->uf_args.ga_len;
@@ -1898,6 +1901,7 @@ generate_CALL(
++cl->class_refcount;
isn->isn_arg.mfunc->cmf_idx = mi;
isn->isn_arg.mfunc->cmf_argcount = argcount;
isn->isn_arg.mfunc->cmf_is_super = is_super;
}
else if (isn->isn_type == ISN_DCALL)
{