Mercurial > vim
diff src/vim9compile.c @ 21196:f45ce1ce284c v8.2.1149
patch 8.2.1149: Vim9: :eval command not handled properly
Commit: https://github.com/vim/vim/commit/007f9d6ed597bd212acb95be9d0767c97d2a1438
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 6 23:04:49 2020 +0200
patch 8.2.1149: Vim9: :eval command not handled properly
Problem: Vim9: :eval command not handled properly.
Solution: Compile the :eval command. (closes https://github.com/vim/vim/issues/6408)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 06 Jul 2020 23:15:04 +0200 |
parents | afed2045ffc9 |
children | 1a4e22aa2eb3 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -3852,7 +3852,6 @@ compile_expr7( char_u *start = skipwhite(*arg + 1); // Find out what comes after the arguments. - // TODO: pass getline function ret = get_function_args(&start, '-', NULL, NULL, NULL, NULL, TRUE, NULL, NULL); if (ret != FAIL && *start == '>') @@ -6990,21 +6989,12 @@ compile_def_function(ufunc_T *ufunc, int } // Expression or function call. - if (ea.cmdidx == CMD_eval) + if (ea.cmdidx != CMD_eval) { - p = ea.cmd; - if (compile_expr0(&p, &cctx) == FAIL) - goto erret; - - // drop the return value - generate_instr_drop(&cctx, ISN_DROP, 1); - - line = skipwhite(p); - continue; + // CMD_let cannot happen, compile_assignment() above is used + iemsg("Command from find_ex_command() not handled"); + goto erret; } - // CMD_let cannot happen, compile_assignment() above is used - iemsg("Command from find_ex_command() not handled"); - goto erret; } p = skipwhite(p); @@ -7124,6 +7114,16 @@ compile_def_function(ufunc_T *ufunc, int line = compile_throw(p, &cctx); break; + case CMD_eval: + if (compile_expr0(&p, &cctx) == FAIL) + goto erret; + + // drop the return value + generate_instr_drop(&cctx, ISN_DROP, 1); + + line = skipwhite(p); + break; + case CMD_echo: case CMD_echon: case CMD_execute: