From d5abb4c87727eecb71b0e8ffdda60fc9598272f3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Jul 2019 22:46:10 +0200 Subject: 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. --- src/eval.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/eval.c') 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 @@ -4575,13 +4576,25 @@ eval7( case '[': ret = get_list_tv(arg, rettv, evaluate); 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; /* -- cgit v1.2.3