diff src/eval.c @ 17368:6604ecb7a615 v8.1.1683

patch 8.1.1683: dictionary with string keys is longer than needed commit https://github.com/vim/vim/commit/d5abb4c87727eecb71b0e8ffdda60fc9598272f3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 22:46:10 2019 +0200 patch 8.1.1683: dictionary with string keys is longer than needed Problem: Dictionary with string keys is longer than needed. Solution: Use *{key: val} for literaly keys.
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 23:00:05 +0200
parents ccd21c8f916b
children 6f36caf4f702
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -4391,7 +4391,8 @@ eval6(
  *  $VAR		environment variable
  *  (expression)	nested expression
  *  [expr, expr]	List
- *  {key: val, key: val}  Dictionary
+ *  {key: val, key: val}   Dictionary
+ *  *{key: val, key: val}  Dictionary with literal keys
  *
  *  Also handle:
  *  ! in front		logical NOT
@@ -4576,12 +4577,24 @@ eval7(
 		break;
 
     /*
+     * Dictionary: *{key: val, key: val}
+     */
+    case '*':	if ((*arg)[1] == '{')
+		{
+		    ++*arg;
+		    ret = dict_get_tv(arg, rettv, evaluate, TRUE);
+		}
+		else
+		    ret = NOTDONE;
+		break;
+
+    /*
      * Lambda: {arg, arg -> expr}
-     * Dictionary: {key: val, key: val}
+     * Dictionary: {'key': val, 'key': val}
      */
     case '{':	ret = get_lambda_tv(arg, rettv, evaluate);
 		if (ret == NOTDONE)
-		    ret = dict_get_tv(arg, rettv, evaluate);
+		    ret = dict_get_tv(arg, rettv, evaluate, FALSE);
 		break;
 
     /*