0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2926: Vim9: no good error for using :legacy in a :def function

Problem:    Vim9: no good error for using :legacy in a :def function.
Solution:   Give an explicit error where :legacy is not working.
            (closes #8309)
This commit is contained in:
Bram Moolenaar
2021-06-02 16:47:53 +02:00
parent 0f37e3561d
commit c3cb1c92a3
4 changed files with 34 additions and 0 deletions

View File

@@ -9222,6 +9222,27 @@ compile_def_function(
{
char_u *start = ea.cmd;
switch (ea.cmdidx)
{
case CMD_if:
case CMD_elseif:
case CMD_else:
case CMD_endif:
case CMD_for:
case CMD_endfor:
case CMD_continue:
case CMD_break:
case CMD_while:
case CMD_endwhile:
case CMD_try:
case CMD_catch:
case CMD_finally:
case CMD_endtry:
semsg(_(e_cannot_use_legacy_with_command_str), ea.cmd);
goto erret;
default: break;
}
// ":legacy return expr" needs to be handled differently.
if (checkforcmd(&start, "return", 4))
ea.cmdidx = CMD_return;