diff src/vim9execute.c @ 23543:f90e429453fd v8.2.2314

patch 8.2.2314: Vim9: returning zero takes two instructions Commit: https://github.com/vim/vim/commit/299f3036ec21cc9735846b2e0dfdfc5a78b26c1c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 8 20:53:09 2021 +0100 patch 8.2.2314: Vim9: returning zero takes two instructions Problem: Vim9: returning zero takes two instructions. Solution: Add ISN_RETURN_ZERO.
author Bram Moolenaar <Bram@vim.org>
date Fri, 08 Jan 2021 21:00:04 +0100
parents a2a38bc68dd9
children 1bb7fa4f9b35
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2205,6 +2205,16 @@ call_def_function(
 		break;
 
 	    // return from a :def function call
+	    case ISN_RETURN_ZERO:
+		if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
+		    goto failed;
+		tv = STACK_TV_BOT(0);
+		++ectx.ec_stack.ga_len;
+		tv->v_type = VAR_NUMBER;
+		tv->vval.v_number = 0;
+		tv->v_lock = 0;
+		// FALLTHROUGH
+
 	    case ISN_RETURN:
 		{
 		    garray_T	*trystack = &ectx.ec_trystack;
@@ -3804,6 +3814,9 @@ ex_disassemble(exarg_T *eap)
 	    case ISN_RETURN:
 		smsg("%4d RETURN", current);
 		break;
+	    case ISN_RETURN_ZERO:
+		smsg("%4d RETURN 0", current);
+		break;
 	    case ISN_FUNCREF:
 		{
 		    funcref_T	*funcref = &iptr->isn_arg.funcref;