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

patch 9.1.0335: String interpolation fails for List type

Problem:  String interpolation fails for List type
Solution: use implicit string(list) for string interpolation and :put =
          (Yegappan Lakshmanan)

related: #14529
closes: #14556

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-04-15 19:19:52 +02:00
committed by Christian Brabandt
parent a59e031aa0
commit bce51d9005
15 changed files with 160 additions and 33 deletions

View File

@@ -1638,7 +1638,7 @@ store_var(char_u *name, typval_T *tv)
* Return FAIL if not allowed.
*/
static int
do_2string(typval_T *tv, int is_2string_any, int tolerant)
do_2string(typval_T *tv, int is_2string_any, int tostring_flags)
{
if (tv->v_type == VAR_STRING)
return OK;
@@ -1657,7 +1657,7 @@ do_2string(typval_T *tv, int is_2string_any, int tolerant)
case VAR_BLOB: break;
case VAR_LIST:
if (tolerant)
if (tostring_flags & TOSTRING_TOLERANT)
{
char_u *s, *e, *p;
garray_T ga;
@@ -1690,6 +1690,8 @@ do_2string(typval_T *tv, int is_2string_any, int tolerant)
tv->vval.v_string = ga.ga_data;
return OK;
}
if (tostring_flags & TOSTRING_INTERPOLATE)
break;
// FALLTHROUGH
default: to_string_error(tv->v_type);
return FAIL;
@@ -5685,7 +5687,7 @@ exec_instructions(ectx_T *ectx)
SOURCING_LNUM = iptr->isn_lnum;
if (do_2string(STACK_TV_BOT(iptr->isn_arg.tostring.offset),
iptr->isn_type == ISN_2STRING_ANY,
iptr->isn_arg.tostring.tolerant) == FAIL)
iptr->isn_arg.tostring.flags) == FAIL)
goto on_error;
break;