comparison src/vim9compile.c @ 24776:7464d4c927f5 v8.2.2926

patch 8.2.2926: Vim9: no good error for using :legacy in a :def function Commit: https://github.com/vim/vim/commit/c3cb1c92a335be818971acd89f631e82aa30ad3f Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 2 16:47:53 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Jun 2021 17:00:04 +0200
parents bf8feac8a89a
children 7c1375eb1636
comparison
equal deleted inserted replaced
24775:f3e925a22651 24776:7464d4c927f5
9219 9219
9220 // When using ":legacy cmd" always use compile_exec(). 9220 // When using ":legacy cmd" always use compile_exec().
9221 if (local_cmdmod.cmod_flags & CMOD_LEGACY) 9221 if (local_cmdmod.cmod_flags & CMOD_LEGACY)
9222 { 9222 {
9223 char_u *start = ea.cmd; 9223 char_u *start = ea.cmd;
9224
9225 switch (ea.cmdidx)
9226 {
9227 case CMD_if:
9228 case CMD_elseif:
9229 case CMD_else:
9230 case CMD_endif:
9231 case CMD_for:
9232 case CMD_endfor:
9233 case CMD_continue:
9234 case CMD_break:
9235 case CMD_while:
9236 case CMD_endwhile:
9237 case CMD_try:
9238 case CMD_catch:
9239 case CMD_finally:
9240 case CMD_endtry:
9241 semsg(_(e_cannot_use_legacy_with_command_str), ea.cmd);
9242 goto erret;
9243 default: break;
9244 }
9224 9245
9225 // ":legacy return expr" needs to be handled differently. 9246 // ":legacy return expr" needs to be handled differently.
9226 if (checkforcmd(&start, "return", 4)) 9247 if (checkforcmd(&start, "return", 4))
9227 ea.cmdidx = CMD_return; 9248 ea.cmdidx = CMD_return;
9228 else 9249 else