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>
diff --git a/src/eval.c b/src/eval.c
index fd44db6..ca5a268 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6318,36 +6318,9 @@
 	    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: