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)
diff --git a/src/userfunc.c b/src/userfunc.c
index 814d400..1918e54 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -3444,8 +3444,10 @@
;
// 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 @@
// 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))