diff src/vim9compile.c @ 27869:6a0ecde89d35 v8.2.4460

patch 8.2.4460: Vim9: wrong error for defining dict function Commit: https://github.com/vim/vim/commit/dea5ab0fc5bb51105078d5349f987496b1aa8d6f Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 23 22:12:02 2022 +0000 patch 8.2.4460: Vim9: wrong error for defining dict function Problem: Vim9: wrong error for defining dict function. Solution: Explicitly check for trying to define a dict function. (closes 9827)
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Feb 2022 23:15:03 +0100
parents 532a0c5de1ec
children 40c6e5f849dc
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -831,7 +831,11 @@ compile_nested_function(exarg_T *eap, cc
     {
 	if (!ends_excmd2(name_start, name_end))
 	{
-	    semsg(_(e_invalid_command_str), eap->cmd);
+	    if (*skipwhite(name_end) == '.')
+		semsg(_(e_cannot_define_dict_func_in_vim9_script_str),
+								     eap->cmd);
+	    else
+		semsg(_(e_invalid_command_str), eap->cmd);
 	    return NULL;
 	}