1
0
forked from aniani/vim

patch 8.2.2291: Vim9: cannot use "null" for v:null

Problem:    Vim9: cannot use "null" for v:null.
Solution:   Support "null" like "true" and "false". (closes #7495)
This commit is contained in:
Bram Moolenaar
2021-01-03 21:53:53 +01:00
parent 2ef951dd31
commit 6797782127
5 changed files with 28 additions and 8 deletions

View File

@@ -3967,6 +3967,20 @@ compile_expr7(
ret = NOTDONE;
break;
/*
* "null" constant
*/
case 'n': if (STRNCMP(*arg, "null", 4) == 0
&& !eval_isnamec((*arg)[5]))
{
*arg += 4;
rettv->v_type = VAR_SPECIAL;
rettv->vval.v_number = VVAL_NULL;
}
else
ret = NOTDONE;
break;
/*
* List: [expr, expr]
*/
@@ -5006,6 +5020,7 @@ assignment_len(char_u *p, int *heredoc)
static char *reserved[] = {
"true",
"false",
"null",
NULL
};