Mercurial > vim
diff src/vim9execute.c @ 24936:345619f35112 v8.2.3005
patch 8.2.3005: Vim9: using a void value does not give a proper error message
Commit: https://github.com/vim/vim/commit/f57b43c230c23117650c956c1f62546a34500fb6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 15 22:13:27 2021 +0200
patch 8.2.3005: Vim9: using a void value does not give a proper error message
Problem: Vim9: using a void value does not give a proper error message.
Solution: Give a clear error message. (clodes https://github.com/vim/vim/issues/8387)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Jun 2021 22:15:03 +0200 |
parents | afaa7f3aae56 |
children | 5c418c774f95 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -2815,17 +2815,18 @@ exec_instructions(ectx_T *ectx) } break; - // return from a :def function call - case ISN_RETURN_ZERO: + // return from a :def function call without a value + case ISN_RETURN_VOID: if (GA_GROW(&ectx->ec_stack, 1) == FAIL) goto theend; tv = STACK_TV_BOT(0); ++ectx->ec_stack.ga_len; - tv->v_type = VAR_NUMBER; + tv->v_type = VAR_VOID; tv->vval.v_number = 0; tv->v_lock = 0; // FALLTHROUGH + // return from a :def function call with what is on the stack case ISN_RETURN: { garray_T *trystack = &ectx->ec_trystack; @@ -5076,8 +5077,8 @@ list_instructions(char *pfx, isn_T *inst case ISN_RETURN: smsg("%s%4d RETURN", pfx, current); break; - case ISN_RETURN_ZERO: - smsg("%s%4d RETURN 0", pfx, current); + case ISN_RETURN_VOID: + smsg("%s%4d RETURN void", pfx, current); break; case ISN_FUNCREF: {