diff src/evalvars.c @ 21955:3991a6df522e v8.2.1527

patch 8.2.1527: Vim9: cannot use a function name at script level Commit: https://github.com/vim/vim/commit/601e76ac3c8fa5d65ac04647a762792ea343ebd5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 27 21:33:10 2020 +0200 patch 8.2.1527: Vim9: cannot use a function name at script level Problem: Vim9: cannot use a function name as a function reference at script level. Solution: Check if a name is a function name. (closes #6789)
author Bram Moolenaar <Bram@vim.org>
date Thu, 27 Aug 2020 21:45:04 +0200
parents a211bca98bc3
children a98211c3e14e
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2461,6 +2461,20 @@ eval_variable(
 		tv = sv->sv_tv;
 	    }
 	}
+	else if (in_vim9script())
+	{
+	    ufunc_T *ufunc = find_func(name, FALSE, NULL);
+
+	    if (ufunc != NULL)
+	    {
+		foundFunc = TRUE;
+		if (rettv != NULL)
+		{
+		    rettv->v_type = VAR_FUNC;
+		    rettv->vval.v_string = vim_strsave(ufunc->uf_name);
+		}
+	    }
+	}
     }
 
     if (!foundFunc)