Mercurial > vim
diff src/vim9compile.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 | fad124c0e349 |
children | d54dfb5f12db |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -2869,14 +2869,14 @@ to_name_const_end(char_u *arg) { // Can be "[1, 2, 3]->Func()". - if (get_list_tv(&p, &rettv, FALSE, FALSE) == FAIL) + if (get_list_tv(&p, &rettv, 0, FALSE) == FAIL) p = arg; } else if (p == arg && *arg == '#' && arg[1] == '{') { // Can be "#{a: 1}->Func()". ++p; - if (eval_dict(&p, &rettv, FALSE, TRUE) == FAIL) + if (eval_dict(&p, &rettv, 0, TRUE) == FAIL) p = arg; } else if (p == arg && *arg == '{') @@ -2886,7 +2886,7 @@ to_name_const_end(char_u *arg) // Can be "{x -> ret}()". // Can be "{'a': 1}->Func()". if (ret == NOTDONE) - ret = eval_dict(&p, &rettv, FALSE, FALSE); + ret = eval_dict(&p, &rettv, 0, FALSE); if (ret != OK) p = arg; }