diff src/evalfunc.c @ 20079:336483164ca6 v8.2.0595

patch 8.2.0595: Vim9: not all commands using ends_excmd() tested Commit: https://github.com/vim/vim/commit/a26b9700d73ebccd6c5459d0d66032a4249f6b72 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 18 19:53:28 2020 +0200 patch 8.2.0595: Vim9: not all commands using ends_excmd() tested Problem: Vim9: not all commands using ends_excmd() tested. Solution: Find # comment after regular commands. Add more tests. Report error for where it was caused.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 Apr 2020 20:00:04 +0200
parents aadd1cae2ff5
children 63cc54100ae4
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2706,6 +2706,17 @@ common_function(typval_T *argvars, typva
 	     TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD | TFN_NO_DEREF, NULL, NULL);
 	if (*name != NUL)
 	    s = NULL;
+	else if (trans_name != NULL
+		&& ASCII_ISUPPER(*s)
+		&& current_sctx.sc_version == SCRIPT_VERSION_VIM9
+		&& find_func(trans_name, NULL) == NULL)
+	{
+	    // With Vim9 script "MyFunc" can be script-local to the current
+	    // script or global.  The script-local name is not found, assume
+	    // global.
+	    vim_free(trans_name);
+	    trans_name = vim_strsave(s);
+	}
     }
 
     if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))