@@ -295,7 +295,7 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate)
295295 if (ret == FAIL || * * arg != '>' )
296296 goto errret ;
297297
298- /* Set up dictionaries for checking local variables and arguments. */
298+ /* Set up a flag for checking local variables and arguments. */
299299 if (evaluate )
300300 eval_lavars_used = & eval_lavars ;
301301
@@ -1504,6 +1504,7 @@ list_func_head(ufunc_T *fp, int indent)
15041504 * TFN_INT: internal function name OK
15051505 * TFN_QUIET: be quiet
15061506 * TFN_NO_AUTOLOAD: do not use script autoloading
1507+ * TFN_NO_DEREF: do not dereference a Funcref
15071508 * Advances "pp" to just after the function name (if no error).
15081509 */
15091510 static char_u *
@@ -1618,7 +1619,7 @@ trans_function_name(
16181619 if (name == lv .ll_exp_name )
16191620 name = NULL ;
16201621 }
1621- else
1622+ else if (!( flags & TFN_NO_DEREF ))
16221623 {
16231624 len = (int )(end - * pp );
16241625 name = deref_func_name (* pp , & len , partial , flags & TFN_NO_AUTOLOAD );
@@ -1690,7 +1691,7 @@ trans_function_name(
16901691 start );
16911692 goto theend ;
16921693 }
1693- if (!skip && !(flags & TFN_QUIET ))
1694+ if (!skip && !(flags & TFN_QUIET ) && !( flags & TFN_NO_DEREF ) )
16941695 {
16951696 char_u * cp = vim_strchr (lv .ll_name , ':' );
16961697
@@ -2381,16 +2382,20 @@ translated_function_exists(char_u *name)
23812382
23822383/*
23832384 * Return TRUE if a function "name" exists.
2385+ * If "no_defef" is TRUE, do not dereference a Funcref.
23842386 */
23852387 int
2386- function_exists (char_u * name )
2388+ function_exists (char_u * name , int no_deref )
23872389{
23882390 char_u * nm = name ;
23892391 char_u * p ;
23902392 int n = FALSE;
2393+ int flag ;
23912394
2392- p = trans_function_name (& nm , FALSE, TFN_INT |TFN_QUIET |TFN_NO_AUTOLOAD ,
2393- NULL , NULL );
2395+ flag = TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD ;
2396+ if (no_deref )
2397+ flag |= TFN_NO_DEREF ;
2398+ p = trans_function_name (& nm , FALSE, flag , NULL , NULL );
23942399 nm = skipwhite (nm );
23952400
23962401 /* Only accept "funcname", "funcname ", "funcname (..." and
0 commit comments