comparison 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
comparison
equal deleted inserted replaced
17367:d2959e9ddc7c 17368:6604ecb7a615
4389 * identifier variable value 4389 * identifier variable value
4390 * function() function call 4390 * function() function call
4391 * $VAR environment variable 4391 * $VAR environment variable
4392 * (expression) nested expression 4392 * (expression) nested expression
4393 * [expr, expr] List 4393 * [expr, expr] List
4394 * {key: val, key: val} Dictionary 4394 * {key: val, key: val} Dictionary
4395 * *{key: val, key: val} Dictionary with literal keys
4395 * 4396 *
4396 * Also handle: 4397 * Also handle:
4397 * ! in front logical NOT 4398 * ! in front logical NOT
4398 * - in front unary minus 4399 * - in front unary minus
4399 * + in front unary plus (ignored) 4400 * + in front unary plus (ignored)
4574 */ 4575 */
4575 case '[': ret = get_list_tv(arg, rettv, evaluate); 4576 case '[': ret = get_list_tv(arg, rettv, evaluate);
4576 break; 4577 break;
4577 4578
4578 /* 4579 /*
4580 * Dictionary: *{key: val, key: val}
4581 */
4582 case '*': if ((*arg)[1] == '{')
4583 {
4584 ++*arg;
4585 ret = dict_get_tv(arg, rettv, evaluate, TRUE);
4586 }
4587 else
4588 ret = NOTDONE;
4589 break;
4590
4591 /*
4579 * Lambda: {arg, arg -> expr} 4592 * Lambda: {arg, arg -> expr}
4580 * Dictionary: {key: val, key: val} 4593 * Dictionary: {'key': val, 'key': val}
4581 */ 4594 */
4582 case '{': ret = get_lambda_tv(arg, rettv, evaluate); 4595 case '{': ret = get_lambda_tv(arg, rettv, evaluate);
4583 if (ret == NOTDONE) 4596 if (ret == NOTDONE)
4584 ret = dict_get_tv(arg, rettv, evaluate); 4597 ret = dict_get_tv(arg, rettv, evaluate, FALSE);
4585 break; 4598 break;
4586 4599
4587 /* 4600 /*
4588 * Option value: &name 4601 * Option value: &name
4589 */ 4602 */