summaryrefslogtreecommitdiffstats
path: root/src/vim9instr.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2024-04-15 19:19:52 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-15 19:19:52 +0200
commitbce51d9005dd1c5bc002acbac2e12b649abcb013 (patch)
tree046a2767183c0fd9eff9249fd44ed676db906de3 /src/vim9instr.c
parenta59e031aa0bdc5cc3d1f4ed719126bf1a1b858ce (diff)
patch 9.1.0335: String interpolation fails for List typev9.1.0335
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>
Diffstat (limited to 'src/vim9instr.c')
-rw-r--r--src/vim9instr.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vim9instr.c b/src/vim9instr.c
index 48ebf1ae4b..4df63fd09a 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -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;
}