@@ -1452,7 +1452,7 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount)
14521452 ufunc -> uf_def_status != UF_NOT_COMPILED ? ISN_DCALL
14531453 : ISN_UCALL )) == NULL )
14541454 return FAIL ;
1455- if (ufunc -> uf_def_status != UF_NOT_COMPILED )
1455+ if (isn -> isn_type == ISN_DCALL )
14561456 {
14571457 isn -> isn_arg .dfunc .cdf_idx = ufunc -> uf_dfunc_idx ;
14581458 isn -> isn_arg .dfunc .cdf_argcount = argcount ;
@@ -2634,8 +2634,8 @@ compile_lambda_call(char_u **arg, cctx_T *cctx)
26342634 clear_tv (& rettv );
26352635 ga_init2 (& ufunc -> uf_type_list , sizeof (type_T * ), 10 );
26362636
2637- // The function will have one line: "return {expr}".
2638- // Compile it into instructions .
2637+ // The function will have one line: "return {expr}". Compile it into
2638+ // instructions so that we get any errors right now .
26392639 compile_def_function (ufunc , TRUE, cctx );
26402640
26412641 // compile the arguments
@@ -7285,7 +7285,19 @@ delete_instr(isn_T *isn)
72857285 {
72867286 dfunc_T * dfunc = ((dfunc_T * )def_functions .ga_data )
72877287 + isn -> isn_arg .funcref .fr_func ;
7288- func_ptr_unref (dfunc -> df_ufunc );
7288+
7289+ if (func_name_refcount (dfunc -> df_ufunc -> uf_name ))
7290+ func_ptr_unref (dfunc -> df_ufunc );
7291+ }
7292+ break ;
7293+
7294+ case ISN_DCALL :
7295+ {
7296+ dfunc_T * dfunc = ((dfunc_T * )def_functions .ga_data )
7297+ + isn -> isn_arg .dfunc .cdf_idx ;
7298+
7299+ if (func_name_refcount (dfunc -> df_ufunc -> uf_name ))
7300+ func_ptr_unref (dfunc -> df_ufunc );
72897301 }
72907302 break ;
72917303
@@ -7333,7 +7345,6 @@ delete_instr(isn_T *isn)
73337345 case ISN_COMPARESPECIAL :
73347346 case ISN_COMPARESTRING :
73357347 case ISN_CONCAT :
7336- case ISN_DCALL :
73377348 case ISN_DROP :
73387349 case ISN_ECHO :
73397350 case ISN_ECHOERR :
0 commit comments