@@ -4694,21 +4694,24 @@ compile_return(char_u *arg, int set_return_type, cctx_T *cctx)
46944694 if (compile_expr0 (& p , cctx ) == FAIL )
46954695 return NULL ;
46964696
4697- stack_type = ((type_T * * )stack -> ga_data )[stack -> ga_len - 1 ];
4698- if (set_return_type )
4699- cctx -> ctx_ufunc -> uf_ret_type = stack_type ;
4700- else
4697+ if (cctx -> ctx_skip != SKIP_YES )
47014698 {
4702- if (cctx -> ctx_ufunc -> uf_ret_type -> tt_type == VAR_VOID
4703- && stack_type -> tt_type != VAR_VOID
4704- && stack_type -> tt_type != VAR_UNKNOWN )
4699+ stack_type = ((type_T * * )stack -> ga_data )[stack -> ga_len - 1 ];
4700+ if (set_return_type )
4701+ cctx -> ctx_ufunc -> uf_ret_type = stack_type ;
4702+ else
47054703 {
4706- emsg (_ (e_returning_value_in_function_without_return_type ));
4707- return NULL ;
4708- }
4709- if (need_type (stack_type , cctx -> ctx_ufunc -> uf_ret_type , -1 ,
4704+ if (cctx -> ctx_ufunc -> uf_ret_type -> tt_type == VAR_VOID
4705+ && stack_type -> tt_type != VAR_VOID
4706+ && stack_type -> tt_type != VAR_UNKNOWN )
4707+ {
4708+ emsg (_ (e_returning_value_in_function_without_return_type ));
4709+ return NULL ;
4710+ }
4711+ if (need_type (stack_type , cctx -> ctx_ufunc -> uf_ret_type , -1 ,
47104712 cctx , FALSE, FALSE) == FAIL )
4711- return NULL ;
4713+ return NULL ;
4714+ }
47124715 }
47134716 }
47144717 else
@@ -4725,8 +4728,7 @@ compile_return(char_u *arg, int set_return_type, cctx_T *cctx)
47254728 // No argument, return zero.
47264729 generate_PUSHNR (cctx , 0 );
47274730 }
4728-
4729- if (generate_instr (cctx , ISN_RETURN ) == NULL )
4731+ if (cctx -> ctx_skip != SKIP_YES && generate_instr (cctx , ISN_RETURN ) == NULL )
47304732 return NULL ;
47314733
47324734 // "return val | endif" is possible
0 commit comments