diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-13 21:59:33 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-13 21:59:33 +0200 |
commit | 5d2eb0fff0fbe905da2c57fd73f7f127a73d1c99 (patch) | |
tree | 8e6d2f9c474df1b157244d7431556e95401edff9 /src/eval.c | |
parent | 3ac9c4701a5f1e39303ca2885956db92215966db (diff) |
patch 8.2.1204: Vim9: true and false not recognized in Vim9 scriptv8.2.1204
Problem: Vim9: true and false not recognized in Vim9 script.
Solution: Recognize true and false.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 14c2849e82..c524151304 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3079,8 +3079,22 @@ eval7( else if (flags & EVAL_CONSTANT) ret = FAIL; else if (evaluate) - // get value of variable - ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE); + { + // get the value of "true", "false" or a variable + if (len == 4 && in_vim9script() && STRNCMP(s, "true", 4) == 0) + { + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_TRUE; + } + else if (len == 5 && in_vim9script() + && STRNCMP(s, "false", 4) == 0) + { + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_FALSE; + } + else + ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE); + } else { // skip the name |