Mercurial > vim
diff src/userfunc.c @ 27978:442ca2007bec v8.2.4514
patch 8.2.4514: Vim9: some flow commands can be shortened
Commit: https://github.com/vim/vim/commit/b2175220dafc28349b275ac7f3080f89cce78a57
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 5 20:24:41 2022 +0000
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".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Mar 2022 21:30:03 +0100 |
parents | 8e630053c59c |
children | 02f787034998 |
line wrap: on
line diff
--- 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;