0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

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".
This commit is contained in:
Bram Moolenaar
2022-03-05 20:24:41 +00:00
parent b29ae15977
commit b2175220da
6 changed files with 40 additions and 10 deletions

View File

@@ -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;