summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-07-13 22:46:10 +0200
committerBram Moolenaar <Bram@vim.org>2019-07-13 22:46:10 +0200
commitd5abb4c87727eecb71b0e8ffdda60fc9598272f3 (patch)
tree0166ed6641ae120fe56c807f90a88e071aa74bbd /src/eval.c
parent809ce4d317fe12db0b2c17f16b4f77200fb060c4 (diff)
patch 8.1.1683: dictionary with string keys is longer than neededv8.1.1683
Problem: Dictionary with string keys is longer than needed. Solution: Use *{key: val} for literaly keys.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c
index d89093cb33..20cec169bf 100644
--- 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;
/*