Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
24935:68f1020e0c69 | 24936:345619f35112 |
---|---|
2813 ectx, iptr) == FAIL) | 2813 ectx, iptr) == FAIL) |
2814 goto on_error; | 2814 goto on_error; |
2815 } | 2815 } |
2816 break; | 2816 break; |
2817 | 2817 |
2818 // return from a :def function call | 2818 // return from a :def function call without a value |
2819 case ISN_RETURN_ZERO: | 2819 case ISN_RETURN_VOID: |
2820 if (GA_GROW(&ectx->ec_stack, 1) == FAIL) | 2820 if (GA_GROW(&ectx->ec_stack, 1) == FAIL) |
2821 goto theend; | 2821 goto theend; |
2822 tv = STACK_TV_BOT(0); | 2822 tv = STACK_TV_BOT(0); |
2823 ++ectx->ec_stack.ga_len; | 2823 ++ectx->ec_stack.ga_len; |
2824 tv->v_type = VAR_NUMBER; | 2824 tv->v_type = VAR_VOID; |
2825 tv->vval.v_number = 0; | 2825 tv->vval.v_number = 0; |
2826 tv->v_lock = 0; | 2826 tv->v_lock = 0; |
2827 // FALLTHROUGH | 2827 // FALLTHROUGH |
2828 | 2828 |
2829 // return from a :def function call with what is on the stack | |
2829 case ISN_RETURN: | 2830 case ISN_RETURN: |
2830 { | 2831 { |
2831 garray_T *trystack = &ectx->ec_trystack; | 2832 garray_T *trystack = &ectx->ec_trystack; |
2832 trycmd_T *trycmd = NULL; | 2833 trycmd_T *trycmd = NULL; |
2833 | 2834 |
5074 smsg("%s%4d PCALL end", pfx, current); | 5075 smsg("%s%4d PCALL end", pfx, current); |
5075 break; | 5076 break; |
5076 case ISN_RETURN: | 5077 case ISN_RETURN: |
5077 smsg("%s%4d RETURN", pfx, current); | 5078 smsg("%s%4d RETURN", pfx, current); |
5078 break; | 5079 break; |
5079 case ISN_RETURN_ZERO: | 5080 case ISN_RETURN_VOID: |
5080 smsg("%s%4d RETURN 0", pfx, current); | 5081 smsg("%s%4d RETURN void", pfx, current); |
5081 break; | 5082 break; |
5082 case ISN_FUNCREF: | 5083 case ISN_FUNCREF: |
5083 { | 5084 { |
5084 funcref_T *funcref = &iptr->isn_arg.funcref; | 5085 funcref_T *funcref = &iptr->isn_arg.funcref; |
5085 dfunc_T *df = ((dfunc_T *)def_functions.ga_data) | 5086 dfunc_T *df = ((dfunc_T *)def_functions.ga_data) |