diff src/userfunc.c @ 26530:2fbd05a873e3 v8.2.3794

patch 8.2.3794: Vim9: cannot find script-local func using "s:" Commit: https://github.com/vim/vim/commit/33b968dc60c5fa39451098e680c7559ebc65d1a7 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 13 11:31:04 2021 +0000 patch 8.2.3794: Vim9: cannot find script-local func using "s:" Problem: Vim9: cannot find script-local func using "s:". (Yegappan Lakshmanan) Solution: Skip the "s:".
author Bram Moolenaar <Bram@vim.org>
date Mon, 13 Dec 2021 12:45:03 +0100
parents 4a1d2abc2016
children 28745eec1dda
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1885,13 +1885,14 @@ find_func_even_dead(char_u *name, int is
     {
 	char_u	*after_script = NULL;
 	long	sid = 0;
-	int	find_script_local = in_vim9script()
-				     && eval_isnamec1(*name) && name[1] != ':';
+	int	find_script_local = in_vim9script() && eval_isnamec1(*name)
+					   && (name[1] != ':' || *name == 's');
 
 	if (find_script_local)
 	{
 	    // Find script-local function before global one.
-	    func = find_func_with_sid(name, current_sctx.sc_sid);
+	    func = find_func_with_sid(name[0] == 's' && name[1] == ':'
+				       ? name + 2 : name, current_sctx.sc_sid);
 	    if (func != NULL)
 		return func;
 	}