summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-24 18:37:35 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-24 18:37:35 +0200
commit5409f5d8c95007216ae1190565a7a8ee9ebd7100 (patch)
treecbc94bc8f6560299b6ef2224f526ab53c7534bc6 /src/dict.c
parentb7e2483655d9b68df0c7349918027d800051a28a (diff)
patch 8.2.1047: Vim9: script cannot use line continuation like :def functionv8.2.1047
Problem: Vim9: script cannot use line continuation like in a :def function. Solution: Pass the getline function pointer to the eval() functions. Use it for addition and multiplication operators.
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/dict.c b/src/dict.c
index 9d94261986..caa398deba 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -788,12 +788,14 @@ get_literal_key(char_u **arg, typval_T *tv)
/*
* Allocate a variable for a Dictionary and fill it from "*arg".
* "literal" is TRUE for #{key: val}
+ * "flags" can have EVAL_EVALUATE and other EVAL_ flags.
* Return OK or FAIL. Returns NOTDONE for {expr}.
*/
int
eval_dict(char_u **arg, typval_T *rettv, int flags, int literal)
{
int evaluate = flags & EVAL_EVALUATE;
+ evalarg_T evalarg;
dict_T *d = NULL;
typval_T tvkey;
typval_T tv;
@@ -803,6 +805,9 @@ eval_dict(char_u **arg, typval_T *rettv, int flags, int literal)
char_u buf[NUMBUFLEN];
int vim9script = current_sctx.sc_version == SCRIPT_VERSION_VIM9;
+ CLEAR_FIELD(evalarg);
+ evalarg.eval_flags = flags;
+
/*
* First check if it's not a curly-braces thing: {expr}.
* Must do this without evaluating, otherwise a function may be called
@@ -812,7 +817,7 @@ eval_dict(char_u **arg, typval_T *rettv, int flags, int literal)
*/
if (!vim9script && *start != '}')
{
- if (eval1(&start, &tv, 0) == FAIL) // recursive!
+ if (eval1(&start, &tv, NULL) == FAIL) // recursive!
return FAIL;
if (*start == '}')
return NOTDONE;
@@ -832,7 +837,7 @@ eval_dict(char_u **arg, typval_T *rettv, int flags, int literal)
{
if ((literal
? get_literal_key(arg, &tvkey)
- : eval1(arg, &tvkey, flags)) == FAIL) // recursive!
+ : eval1(arg, &tvkey, &evalarg)) == FAIL) // recursive!
goto failret;
if (**arg != ':')
@@ -854,7 +859,7 @@ eval_dict(char_u **arg, typval_T *rettv, int flags, int literal)
}
*arg = skipwhite(*arg + 1);
- if (eval1(arg, &tv, flags) == FAIL) // recursive!
+ if (eval1(arg, &tv, &evalarg) == FAIL) // recursive!
{
if (evaluate)
clear_tv(&tvkey);