patch 9.0.1357: using null_object results in an internal error
Problem: Using null_object results in an internal error. (Ernie Rael)
Solution: Add instructions for pushing an object and class. (closes #12044)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 638dbc5..90594ef 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1944,8 +1944,7 @@
source_cookie_T cookie;
SOURCING_LNUM = iptr->isn_lnum;
- // Pass getsourceline to get an error for a missing ":end"
- // command.
+ // Pass getsourceline to get an error for a missing ":end" command.
CLEAR_FIELD(cookie);
cookie.sourcing_lnum = iptr->isn_lnum - 1;
if (do_cmdline(iptr->isn_arg.string,
@@ -4018,6 +4017,8 @@
case ISN_PUSHFUNC:
case ISN_PUSHCHANNEL:
case ISN_PUSHJOB:
+ case ISN_PUSHOBJ:
+ case ISN_PUSHCLASS:
if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
@@ -4064,6 +4065,14 @@
tv->vval.v_job = NULL;
#endif
break;
+ case ISN_PUSHOBJ:
+ tv->v_type = VAR_OBJECT;
+ tv->vval.v_object = NULL;
+ break;
+ case ISN_PUSHCLASS:
+ tv->v_type = VAR_CLASS;
+ tv->vval.v_class = iptr->isn_arg.class;
+ break;
default:
tv->v_type = VAR_STRING;
tv->vval.v_string = iptr->isn_arg.string == NULL
@@ -6662,6 +6671,14 @@
smsg("%s%4d PUSHJOB \"no process\"", pfx, current);
#endif
break;
+ case ISN_PUSHOBJ:
+ smsg("%s%4d PUSHOBJ null", pfx, current);
+ break;
+ case ISN_PUSHCLASS:
+ smsg("%s%4d PUSHCLASS %s", pfx, current,
+ iptr->isn_arg.class == NULL ? "null"
+ : (char *)iptr->isn_arg.class->class_name);
+ break;
case ISN_PUSHEXC:
smsg("%s%4d PUSH v:exception", pfx, current);
break;