mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.1.0148: Vim9: can't call internal methods with objects
Problem: Vim9: can't call internal methods with objects Solution: Add support for empty(), len() and string() function calls for objects (Yegappan Lakshmanan) closes: #14129 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2157035637
commit
d3eae7bc11
33
src/eval.c
33
src/eval.c
@@ -6318,36 +6318,9 @@ echo_string_core(
|
||||
break;
|
||||
|
||||
case VAR_OBJECT:
|
||||
{
|
||||
garray_T ga;
|
||||
ga_init2(&ga, 1, 50);
|
||||
ga_concat(&ga, (char_u *)"object of ");
|
||||
object_T *obj = tv->vval.v_object;
|
||||
class_T *cl = obj == NULL ? NULL : obj->obj_class;
|
||||
ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]"
|
||||
: cl->class_name);
|
||||
if (cl != NULL)
|
||||
{
|
||||
ga_concat(&ga, (char_u *)" {");
|
||||
for (int i = 0; i < cl->class_obj_member_count; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
ga_concat(&ga, (char_u *)", ");
|
||||
ocmember_T *m = &cl->class_obj_members[i];
|
||||
ga_concat(&ga, m->ocm_name);
|
||||
ga_concat(&ga, (char_u *)": ");
|
||||
char_u *tf = NULL;
|
||||
ga_concat(&ga, echo_string_core(
|
||||
(typval_T *)(obj + 1) + i,
|
||||
&tf, numbuf, copyID, echo_style,
|
||||
restore_copyID, composite_val));
|
||||
vim_free(tf);
|
||||
}
|
||||
ga_concat(&ga, (char_u *)"}");
|
||||
}
|
||||
|
||||
*tofree = r = ga.ga_data;
|
||||
}
|
||||
*tofree = r = object_string(tv->vval.v_object, numbuf, copyID,
|
||||
echo_style, restore_copyID,
|
||||
composite_val);
|
||||
break;
|
||||
|
||||
case VAR_FLOAT:
|
||||
|
Reference in New Issue
Block a user