comparison src/vim9class.c @ 32772:0dc750a24875 v9.0.1703

patch 9.0.1703: Vim9 Calling a method in an extended class fails Commit: https://github.com/vim/vim/commit/74cc13cc402fa4df9033fbbc0643b1b403525950 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Aug 13 17:41:26 2023 +0200 patch 9.0.1703: Vim9 Calling a method in an extended class fails Problem: Vim9 Calling a method in an extended class fails Solution: use method index directly closes: #12778 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 13 Aug 2023 18:00:04 +0200
parents d35204b890af
children ba5a67216596
comparison
equal deleted inserted replaced
32771:7c74934d26f8 32772:0dc750a24875
207 : itf->class_obj_member_count)) 207 : itf->class_obj_member_count))
208 { 208 {
209 siemsg("index %d out of range for interface %s", idx, itf->class_name); 209 siemsg("index %d out of range for interface %s", idx, itf->class_name);
210 return 0; 210 return 0;
211 } 211 }
212
213 // If "cl" is the interface or the class that is extended, then the method
214 // index can be used directly and there is no need to search for the method
215 // index in one of the child classes.
216 if (cl == itf)
217 return idx;
218
212 itf2class_T *i2c; 219 itf2class_T *i2c;
213 for (i2c = itf->class_itf2class; i2c != NULL; i2c = i2c->i2c_next) 220 for (i2c = itf->class_itf2class; i2c != NULL; i2c = i2c->i2c_next)
214 if (i2c->i2c_class == cl && i2c->i2c_is_method == is_method) 221 if (i2c->i2c_class == cl && i2c->i2c_is_method == is_method)
215 break; 222 break;
216 if (i2c == NULL) 223 if (i2c == NULL)