mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -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:
committed by
Christian Brabandt
parent
a59e031aa0
commit
bce51d9005
@@ -191,10 +191,12 @@ generate_STORE_THIS(cctx_T *cctx, int idx)
|
||||
/*
|
||||
* If type at "offset" isn't already VAR_STRING then generate ISN_2STRING.
|
||||
* But only for simple types.
|
||||
* When "tolerant" is TRUE convert most types to string, e.g. a List.
|
||||
* When tostring_flags has TOSTRING_TOLERANT, convert a List to a series of
|
||||
* strings. When tostring_flags has TOSTRING_INTERPOLATE, convert a List or a
|
||||
* Dict to the corresponding textual representation.
|
||||
*/
|
||||
int
|
||||
may_generate_2STRING(int offset, int tolerant, cctx_T *cctx)
|
||||
may_generate_2STRING(int offset, int tostring_flags, cctx_T *cctx)
|
||||
{
|
||||
isn_T *isn;
|
||||
isntype_T isntype = ISN_2STRING;
|
||||
@@ -223,11 +225,13 @@ may_generate_2STRING(int offset, int tolerant, cctx_T *cctx)
|
||||
// conversion possible when tolerant
|
||||
case VAR_LIST:
|
||||
case VAR_DICT:
|
||||
if (tolerant)
|
||||
if (tostring_flags & TOSTRING_TOLERANT)
|
||||
{
|
||||
isntype = ISN_2STRING_ANY;
|
||||
break;
|
||||
}
|
||||
if (tostring_flags & TOSTRING_INTERPOLATE)
|
||||
break;
|
||||
// FALLTHROUGH
|
||||
|
||||
// conversion not possible
|
||||
@@ -249,7 +253,7 @@ may_generate_2STRING(int offset, int tolerant, cctx_T *cctx)
|
||||
if ((isn = generate_instr(cctx, isntype)) == NULL)
|
||||
return FAIL;
|
||||
isn->isn_arg.tostring.offset = offset;
|
||||
isn->isn_arg.tostring.tolerant = tolerant;
|
||||
isn->isn_arg.tostring.flags = tostring_flags;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user