Mercurial > vim
comparison src/list.c @ 20397:c225be44692a v8.2.0753
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Commit: https://github.com/vim/vim/commit/32e351179eacfc84f64cd5029e221582d400bb38
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 14 22:41:15 2020 +0200
patch 8.2.0753: Vim9: expressions are evaluated in the discovery phase
Problem: Vim9: expressions are evaluated in the discovery phase.
Solution: Bail out if an expression is not a constant. Require a type for
declared constants.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 14 May 2020 22:45:04 +0200 |
parents | 4c317d8c1051 |
children | 09143ab0fbbd |
comparison
equal
deleted
inserted
replaced
20396:89228c88b5c4 | 20397:c225be44692a |
---|---|
1044 /* | 1044 /* |
1045 * Allocate a variable for a List and fill it from "*arg". | 1045 * Allocate a variable for a List and fill it from "*arg". |
1046 * Return OK or FAIL. | 1046 * Return OK or FAIL. |
1047 */ | 1047 */ |
1048 int | 1048 int |
1049 get_list_tv(char_u **arg, typval_T *rettv, int evaluate, int do_error) | 1049 get_list_tv(char_u **arg, typval_T *rettv, int flags, int do_error) |
1050 { | 1050 { |
1051 int evaluate = flags & EVAL_EVALUATE; | |
1051 list_T *l = NULL; | 1052 list_T *l = NULL; |
1052 typval_T tv; | 1053 typval_T tv; |
1053 listitem_T *item; | 1054 listitem_T *item; |
1054 | 1055 |
1055 if (evaluate) | 1056 if (evaluate) |
1060 } | 1061 } |
1061 | 1062 |
1062 *arg = skipwhite(*arg + 1); | 1063 *arg = skipwhite(*arg + 1); |
1063 while (**arg != ']' && **arg != NUL) | 1064 while (**arg != ']' && **arg != NUL) |
1064 { | 1065 { |
1065 if (eval1(arg, &tv, evaluate) == FAIL) // recursive! | 1066 if (eval1(arg, &tv, flags) == FAIL) // recursive! |
1066 goto failret; | 1067 goto failret; |
1067 if (evaluate) | 1068 if (evaluate) |
1068 { | 1069 { |
1069 item = listitem_alloc(); | 1070 item = listitem_alloc(); |
1070 if (item != NULL) | 1071 if (item != NULL) |