diff src/userfunc.c @ 21983:3fe594c72d8c v8.2.1541

patch 8.2.1541: Vim9: cannot find function reference for s:Func Commit: https://github.com/vim/vim/commit/95006e3dca099d3dc73d70d9872660308106e86c Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 29 17:47:08 2020 +0200 patch 8.2.1541: Vim9: cannot find function reference for s:Func Problem: Vim9: cannot find function reference for s:Func. Solution: Recognize <SNR> prefix. (closes https://github.com/vim/vim/issues/6805)
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Aug 2020 18:00:04 +0200
parents ba2415df82d7
children ec0a5ae32d5e
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -808,11 +808,12 @@ find_func_even_dead(char_u *name, int is
 
     if (!is_global)
     {
-	int	vim9script = in_vim9script();
 	char_u	*after_script = NULL;
 	long	sid = 0;
-
-	if (vim9script)
+	int	find_script_local = in_vim9script()
+				     && eval_isnamec1(*name) && name[1] != ':';
+
+	if (find_script_local)
 	{
 	    // Find script-local function before global one.
 	    func = find_func_with_sid(name, current_sctx.sc_sid);
@@ -833,7 +834,7 @@ find_func_even_dead(char_u *name, int is
 	    else
 		after_script = NULL;
 	}
-	if (vim9script || after_script != NULL)
+	if (find_script_local || after_script != NULL)
 	{
 	    // Find imported function before global one.
 	    if (after_script != NULL && sid != current_sctx.sc_sid)