diff options
author | ZyX <kp-pav@yandex.ru> | 2017-06-18 15:53:53 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-06-20 18:17:47 +0300 |
commit | bad5b2f8cf03c6cec690e29b937aac2bb7f2d1e0 (patch) | |
tree | 4741c70576a112e29ff5dfc95eebc80b92738d24 | |
parent | e8aa58934ea2a670b9c2702c783611fd0c5beb4d (diff) | |
download | rneovim-bad5b2f8cf03c6cec690e29b937aac2bb7f2d1e0.tar.gz rneovim-bad5b2f8cf03c6cec690e29b937aac2bb7f2d1e0.tar.bz2 rneovim-bad5b2f8cf03c6cec690e29b937aac2bb7f2d1e0.zip |
eval: Error out when there is something after :endfunction
Ref #6844
-rw-r--r-- | src/nvim/eval.c | 10 | ||||
-rw-r--r-- | src/nvim/globals.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index baa61a26bc..c424cfcd80 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19842,8 +19842,16 @@ void ex_function(exarg_T *eap) /* Check for "endfunction". */ if (checkforcmd(&p, "endfunction", 4) && nesting-- == 0) { - if (line_arg == NULL) + if (*p == '!') { + p++; + } + p += strspn((const char *)p, " \t\r\n"); + if (*p != NUL && *p != '"') { + emsgf(_(e_trailing2), p); + } + if (line_arg == NULL) { xfree(theline); + } break; } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 840be928c8..6d1bd1de12 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -1131,6 +1131,7 @@ EXTERN char_u e_longname[] INIT(= N_("E75: Name too long")); EXTERN char_u e_toomsbra[] INIT(= N_("E76: Too many [")); EXTERN char_u e_toomany[] INIT(= N_("E77: Too many file names")); EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters")); +EXTERN char_u e_trailing2[] INIT(= N_("E488: Trailing characters: %s")); EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark")); EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards")); EXTERN char_u e_winheight[] INIT(= N_( |