patch 8.2.4634: Vim9: cannot initialize a variable to null_list
Problem: Vim9: cannot initialize a variable to null_list.
Solution: Give negative count to NEWLIST. (closes #10027)
Also fix inconsistencies in comparing with null values.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 1eb6ce2..4e3a1bf 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1955,7 +1955,7 @@
generate_PUSHS(cctx, &li->li_tv.vval.v_string);
li->li_tv.vval.v_string = NULL;
}
- generate_NEWLIST(cctx, l->lv_len);
+ generate_NEWLIST(cctx, l->lv_len, FALSE);
}
list_free(l);
p += STRLEN(p);
@@ -2239,10 +2239,10 @@
generate_PUSHFUNC(cctx, NULL, &t_func_void);
break;
case VAR_LIST:
- generate_NEWLIST(cctx, 0);
+ generate_NEWLIST(cctx, 0, FALSE);
break;
case VAR_DICT:
- generate_NEWDICT(cctx, 0);
+ generate_NEWDICT(cctx, 0, FALSE);
break;
case VAR_JOB:
generate_PUSHJOB(cctx);