patch 9.0.1952: Vim9: unused static field
Problem: Vim9: unused static field
Solution: remove it and simplify code
closes: #13220
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
diff --git a/src/vim9class.c b/src/vim9class.c
index 29ed6d1..885ac03 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -220,12 +220,10 @@
* "cl" implementing that interface.
*/
int
-object_index_from_itf_index(class_T *itf, int is_method, int idx, class_T *cl,
- int is_static)
+object_index_from_itf_index(class_T *itf, int is_method, int idx, class_T *cl)
{
if (idx >= (is_method ? itf->class_obj_method_count
- : is_static ? itf->class_class_member_count
- : itf->class_obj_member_count))
+ : itf->class_obj_member_count))
{
siemsg("index %d out of range for interface %s", idx, itf->class_name);
return 0;
@@ -255,9 +253,7 @@
if (searching && is_method)
// The parent class methods are stored after the current class
// methods.
- method_offset += is_static
- ? super->class_class_function_count_child
- : super->class_obj_method_count_child;
+ method_offset += super->class_obj_method_count_child;
}
if (i2c == NULL)
{
@@ -265,26 +261,12 @@
cl->class_name, itf->class_name);
return 0;
}
- if (is_static)
- {
- // TODO: Need a table for fast lookup?
- char_u *name = itf->class_class_members[idx].ocm_name;
- int m_idx = class_member_idx(i2c->i2c_class, name, 0);
- if (m_idx >= 0)
- return m_idx;
- siemsg("class %s, interface %s, static %s not found",
- cl->class_name, itf->class_name, name);
- return 0;
- }
- else
- {
- // A table follows the i2c for the class
- int *table = (int *)(i2c + 1);
- // "method_offset" is 0, if method is in the current class. If method
- // is in a parent class, then it is non-zero.
- return table[idx] + method_offset;
- }
+ // A table follows the i2c for the class
+ int *table = (int *)(i2c + 1);
+ // "method_offset" is 0, if method is in the current class. If method
+ // is in a parent class, then it is non-zero.
+ return table[idx] + method_offset;
}
/*