mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.2315: Vim9: "enddef" as dict key misintepreted as function end
Problem: Vim9: "enddef" as dict key misintepreted as function end. Solution: Check for following colon. (closes #7640)
This commit is contained in:
@@ -3444,8 +3444,10 @@ define_function(exarg_T *eap, char_u *name_arg)
|
||||
;
|
||||
|
||||
// Check for "endfunction" or "enddef".
|
||||
// When a ":" follows it must be a dict key; "enddef: value,"
|
||||
if (checkforcmd(&p, nesting_def[nesting]
|
||||
? "enddef" : "endfunction", 4))
|
||||
? "enddef" : "endfunction", 4)
|
||||
&& *p != ':')
|
||||
{
|
||||
if (nesting-- == 0)
|
||||
{
|
||||
@@ -3484,7 +3486,7 @@ define_function(exarg_T *eap, char_u *name_arg)
|
||||
// not find it.
|
||||
else if (nesting_def[nesting])
|
||||
{
|
||||
if (checkforcmd(&p, "endfunction", 4))
|
||||
if (checkforcmd(&p, "endfunction", 4) && *p != ':')
|
||||
emsg(_(e_mismatched_endfunction));
|
||||
}
|
||||
else if (eap->cmdidx == CMD_def && checkforcmd(&p, "enddef", 4))
|
||||
|
Reference in New Issue
Block a user