0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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.
This commit is contained in:
Bram Moolenaar
2020-05-14 22:41:15 +02:00
parent e06a28f5e3
commit 32e351179e
12 changed files with 214 additions and 131 deletions

View File

@@ -2133,7 +2133,7 @@ typedef enum {
// Flags for assignment functions.
#define LET_IS_CONST 1 // ":const"
#define LET_NO_COMMAND 2 // "var = expr" without ":let" or ":const"
#define LET_REDEFINE 4 // variable can be redefined later
#define LET_DISCOVERY 4 // discovery phase: variable can be redefined later
#include "ex_cmds.h" // Ex command defines
#include "spell.h" // spell checking stuff
@@ -2662,4 +2662,8 @@ long elapsed(DWORD start_tick);
#define REPTERM_SPECIAL 4
#define REPTERM_NO_SIMPLIFY 8
// Flags for expression evaluation.
#define EVAL_EVALUATE 1 // when missing don't actually evaluate
#define EVAL_CONSTANT 2 // when not a constant return FAIL
#endif // VIM__H