Mercurial > vim
diff src/vim9execute.c @ 24645:668df21d8bc6 v8.2.2861
patch 8.2.2861: Vim9: "legacy return" is not recognized as a return statement
Commit: https://github.com/vim/vim/commit/3b1373b193ce5fbf25e852277a4ecc98688c7bb8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 17 00:01:42 2021 +0200
patch 8.2.2861: Vim9: "legacy return" is not recognized as a return statement
Problem: Vim9: "legacy return" is not recognized as a return statement.
Solution: Specifically check for a return command. (closes https://github.com/vim/vim/issues/8213)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 May 2021 00:15:03 +0200 |
parents | 4a4f64cdc798 |
children | 982516c8d692 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1388,6 +1388,27 @@ exec_instructions(ectx_T *ectx) } break; + // Evaluate an expression with legacy syntax, push it onto the + // stack. + case ISN_LEGACY_EVAL: + { + char_u *arg = iptr->isn_arg.string; + int res; + int save_flags = cmdmod.cmod_flags; + + if (GA_GROW(&ectx->ec_stack, 1) == FAIL) + return FAIL; + tv = STACK_TV_BOT(0); + init_tv(tv); + cmdmod.cmod_flags |= CMOD_LEGACY; + res = eval0(arg, tv, NULL, &EVALARG_EVALUATE); + cmdmod.cmod_flags = save_flags; + if (res == FAIL) + goto on_error; + ++ectx->ec_stack.ga_len; + } + break; + // push typeval VAR_INSTR with instructions to be executed case ISN_INSTR: { @@ -4464,6 +4485,10 @@ list_instructions(char *pfx, isn_T *inst case ISN_EXEC: smsg("%s%4d EXEC %s", pfx, current, iptr->isn_arg.string); break; + case ISN_LEGACY_EVAL: + smsg("%s%4d EVAL legacy %s", pfx, current, + iptr->isn_arg.string); + break; case ISN_REDIRSTART: smsg("%s%4d REDIR", pfx, current); break;