0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.0233: Vim9: string() output of enum is problematic

Problem:  Vim9: string() output of enum is problematic
Solution: Make string() output for an enum consistent with that of a
          regular object (Yegappan Lakshmanan).

closes: #14343

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-03-31 18:45:35 +02:00
committed by Christian Brabandt
parent 5df961a1bc
commit 3cf121ed31
4 changed files with 38 additions and 17 deletions

View File

@@ -3844,16 +3844,18 @@ object_string(
class_T *cl = obj == NULL ? NULL : obj->obj_class;
if (cl != NULL && IS_ENUM(cl))
{
ga_concat(&ga, (char_u *)"enum ");
ga_concat(&ga, cl->class_name);
char_u *name = ((typval_T *)(obj + 1))->vval.v_string;
char_u *enum_name = ((typval_T *)(obj + 1))->vval.v_string;
ga_concat(&ga, (char_u *)".");
ga_concat(&ga, name);
return ga.ga_data;
ga_concat(&ga, enum_name);
}
else
{
ga_concat(&ga, (char_u *)"object of ");
ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]"
: cl->class_name);
}
ga_concat(&ga, (char_u *)"object of ");
ga_concat(&ga, cl == NULL ? (char_u *)"[unknown]"
: cl->class_name);
if (cl != NULL)
{
ga_concat(&ga, (char_u *)" {");