comparison src/vim9instr.c @ 33233:108d890d887f v9.0.1890

patch 9.0.1890: Vim9: lookup code for class/object repaeated Commit: https://github.com/vim/vim/commit/f36bbcd402c6ee5a27bcab3b20b6362ab93b8898 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Sep 10 18:19:06 2023 +0200 patch 9.0.1890: Vim9: lookup code for class/object repaeated Problem: Vim9: lookup code for class/object repaeated Solution: Refactor and make use of lookup functions closes: #13067 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Sep 2023 18:30:04 +0200
parents 9efd99a717c1
children 877dddec681f
comparison
equal deleted inserted replaced
33232:d72f150af9f1 33233:108d890d887f
1835 // argument is an object member, the type check is performed on 1835 // argument is an object member, the type check is performed on
1836 // the object member type. 1836 // the object member type.
1837 if (class_constructor && expected->tt_type == VAR_ANY) 1837 if (class_constructor && expected->tt_type == VAR_ANY)
1838 { 1838 {
1839 class_T *clp = mtype->tt_class; 1839 class_T *clp = mtype->tt_class;
1840 char_u *aname = ((char_u **)ufunc->uf_args.ga_data)[i]; 1840 char_u *aname = ((char_u **)ufunc->uf_args.ga_data)[i];
1841 for (int om = 0; om < clp->class_obj_member_count; ++om) 1841 int m_idx;
1842 { 1842 ocmember_T *m = object_member_lookup(clp, aname, 0,
1843 if (STRCMP(aname, clp->class_obj_members[om].ocm_name) 1843 &m_idx);
1844 == 0) 1844 if (m != NULL)
1845 { 1845 expected = m->ocm_type;
1846 expected = clp->class_obj_members[om].ocm_type;
1847 break;
1848 }
1849 }
1850
1851 } 1846 }
1852 } 1847 }
1853 else if (ufunc->uf_va_type == NULL 1848 else if (ufunc->uf_va_type == NULL
1854 || ufunc->uf_va_type == &t_list_any) 1849 || ufunc->uf_va_type == &t_list_any)
1855 // possibly a lambda or "...: any" 1850 // possibly a lambda or "...: any"