diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-05 20:24:41 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-05 20:24:41 +0000 |
commit | b2175220dafc28349b275ac7f3080f89cce78a57 (patch) | |
tree | 3ffc364a08fa4c0961a1b38b9a2d0547b6895e18 /src/userfunc.c | |
parent | b29ae159777028bb3266835b55716749ab0515be (diff) | |
download | vim-git-b2175220dafc28349b275ac7f3080f89cce78a57.tar.gz |
patch 8.2.4514: Vim9: some flow commands can be shortenedv8.2.4514
Problem: Vim9: some flow commands can be shortened.
Solution: Also require using the full name for ":return", ":enddef",
":continue", ":export" and ":import".
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 03b310d67..63bb3140a 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -821,6 +821,7 @@ get_function_body( { int c; char_u *end; + char_u *cmd; // skip ':' and blanks for (p = theline; VIM_ISWHITE(*p) || *p == ':'; ++p) @@ -828,12 +829,16 @@ get_function_body( // 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; |