summaryrefslogtreecommitdiffstats
path: root/src/vim9execute.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-04-01 22:05:38 +0100
committerBram Moolenaar <Bram@vim.org>2023-04-01 22:05:38 +0100
commit2ed57ac3675624b9d943d7753f48855e5dbebdbb (patch)
tree213eef0fee9ddfb36cc601580333f34842544894 /src/vim9execute.c
parent38d867f041349e1400c2cce9cac06f59ae6ccbb1 (diff)
patch 9.0.1436: cannot compare a typed variable with v:nonev9.0.1436
Problem: Cannot compare a typed variable with v:none. Solution: Allow for "x is v:none" and "x isnot v:none". (issue #12194)
Diffstat (limited to 'src/vim9execute.c')
-rw-r--r--src/vim9execute.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 18cebdba8c..d558ca0fa2 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3496,7 +3496,15 @@ exec_instructions(ectx_T *ectx)
case ISN_LOAD:
if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
- copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
+ tv = STACK_TV_VAR(iptr->isn_arg.number);
+ if (tv->v_type == VAR_UNKNOWN)
+ {
+ // missing argument or default value v:none
+ STACK_TV_BOT(0)->v_type = VAR_SPECIAL;
+ STACK_TV_BOT(0)->vval.v_number = VVAL_NONE;
+ }
+ else
+ copy_tv(tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
break;