0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-07-13 22:46:10 +02:00
parent 809ce4d317
commit d5abb4c877
15 changed files with 396 additions and 344 deletions

View File

@@ -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;
/*