patch 8.2.4514: Vim9: some flow commands can be shortened
Problem: Vim9: some flow commands can be shortened.
Solution: Also require using the full name for ":return", ":enddef",
":continue", ":export" and ":import".
diff --git a/src/userfunc.c b/src/userfunc.c
index 03b310d..63bb314 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -821,6 +821,7 @@
{
int c;
char_u *end;
+ char_u *cmd;
// skip ':' and blanks
for (p = theline; VIM_ISWHITE(*p) || *p == ':'; ++p)
@@ -828,12 +829,16 @@
// Check for "endfunction", "enddef" or "}".
// When a ":" follows it must be a dict key; "enddef: value,"
+ cmd = p;
if (nesting_inline[nesting]
? *p == '}'
: (checkforcmd(&p, nesting_def[nesting]
? "enddef" : "endfunction", 4)
&& *p != ':'))
{
+ if (!nesting_inline[nesting] && nesting_def[nesting]
+ && p < cmd + 6)
+ semsg(_(e_command_cannot_be_shortened_str), "enddef");
if (nesting-- == 0)
{
char_u *nextcmd = NULL;