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>
diff --git a/src/vim9instr.c b/src/vim9instr.c
index ad8beb1..4368e3c 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1805,6 +1805,8 @@
* 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 @@
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 @@
++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)
{