summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-02 21:12:05 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-02 21:12:05 +0200
commitc3160727b940b762e18fd9431416dc1a4a081c3a (patch)
tree0116dc79803d6c02a7ed407c9db6aba04093f1e6
parentbb7ee7abe1ea1e60b8a5dadd2bed8cdbe4f3e8fb (diff)
downloadvim-git-c3160727b940b762e18fd9431416dc1a4a081c3a.tar.gz
patch 8.2.3277: Vim9: compiled has() does not work properlyv8.2.3277
Problem: Vim9: compiled has() does not work properly. Solution: Fix check for has() vs exists().
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/version.c b/src/version.c
index 879800260..931a81785 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3277,
+/**/
3276,
/**/
3275,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index c4eed5428..c5359fe54 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3402,6 +3402,7 @@ compile_call(
{
char_u *s = skipwhite(*arg + varlen + 1);
typval_T argvars[2];
+ int is_has = **arg == 'h';
argvars[0].v_type = VAR_UNKNOWN;
if (*s == '"')
@@ -3410,8 +3411,8 @@ compile_call(
(void)eval_lit_string(&s, &argvars[0], TRUE);
s = skipwhite(s);
if (*s == ')' && argvars[0].v_type == VAR_STRING
- && ((**arg == 'h' && !dynamic_feature(argvars[0].vval.v_string))
- || (**arg == 'e' && (*argvars[0].vval.v_string == '+'
+ && ((is_has && !dynamic_feature(argvars[0].vval.v_string))
+ || (!is_has && (*argvars[0].vval.v_string == '+'
|| *argvars[0].vval.v_string == '&'))))
{
typval_T *tv = &ppconst->pp_tv[ppconst->pp_used];
@@ -3420,7 +3421,7 @@ compile_call(
argvars[1].v_type = VAR_UNKNOWN;
tv->v_type = VAR_NUMBER;
tv->vval.v_number = 0;
- if (**arg == 'h')
+ if (is_has)
f_has(argvars, tv);
else
f_exists(argvars, tv);
@@ -7096,7 +7097,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if (oplen > 0 && *op != '=')
{
type_T *expected;
- type_T *stacktype;
+ type_T *stacktype = NULL;
if (*op == '.')
{