diff src/dict.c @ 20992:7ee565134d4a v8.2.1047

patch 8.2.1047: Vim9: script cannot use line continuation like :def function Commit: https://github.com/vim/vim/commit/5409f5d8c95007216ae1190565a7a8ee9ebd7100 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 24 18:37:35 2020 +0200 patch 8.2.1047: Vim9: script cannot use line continuation like :def function 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Jun 2020 18:45:04 +0200
parents d9a2e5dcfd9f
children 2f8b0812819f
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -788,12 +788,14 @@ get_literal_key(char_u **arg, typval_T *
 /*
  * 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,
     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,
      */
     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,
     {
 	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,
 	}
 
 	*arg = skipwhite(*arg + 1);
-	if (eval1(arg, &tv, flags) == FAIL)	// recursive!
+	if (eval1(arg, &tv, &evalarg) == FAIL)	// recursive!
 	{
 	    if (evaluate)
 		clear_tv(&tvkey);