Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
21195:a5fcf0c62367 | 21196:f45ce1ce284c |
---|---|
3850 */ | 3850 */ |
3851 case '{': { | 3851 case '{': { |
3852 char_u *start = skipwhite(*arg + 1); | 3852 char_u *start = skipwhite(*arg + 1); |
3853 | 3853 |
3854 // Find out what comes after the arguments. | 3854 // Find out what comes after the arguments. |
3855 // TODO: pass getline function | |
3856 ret = get_function_args(&start, '-', NULL, | 3855 ret = get_function_args(&start, '-', NULL, |
3857 NULL, NULL, NULL, TRUE, NULL, NULL); | 3856 NULL, NULL, NULL, TRUE, NULL, NULL); |
3858 if (ret != FAIL && *start == '>') | 3857 if (ret != FAIL && *start == '>') |
3859 ret = compile_lambda(arg, cctx); | 3858 ret = compile_lambda(arg, cctx); |
3860 else | 3859 else |
6988 line += STRLEN(line); | 6987 line += STRLEN(line); |
6989 continue; | 6988 continue; |
6990 } | 6989 } |
6991 | 6990 |
6992 // Expression or function call. | 6991 // Expression or function call. |
6993 if (ea.cmdidx == CMD_eval) | 6992 if (ea.cmdidx != CMD_eval) |
6994 { | 6993 { |
6995 p = ea.cmd; | 6994 // CMD_let cannot happen, compile_assignment() above is used |
6996 if (compile_expr0(&p, &cctx) == FAIL) | 6995 iemsg("Command from find_ex_command() not handled"); |
6997 goto erret; | 6996 goto erret; |
6998 | 6997 } |
6999 // drop the return value | |
7000 generate_instr_drop(&cctx, ISN_DROP, 1); | |
7001 | |
7002 line = skipwhite(p); | |
7003 continue; | |
7004 } | |
7005 // CMD_let cannot happen, compile_assignment() above is used | |
7006 iemsg("Command from find_ex_command() not handled"); | |
7007 goto erret; | |
7008 } | 6998 } |
7009 | 6999 |
7010 p = skipwhite(p); | 7000 p = skipwhite(p); |
7011 | 7001 |
7012 if (cctx.ctx_skip == SKIP_YES | 7002 if (cctx.ctx_skip == SKIP_YES |
7120 line = compile_endtry(p, &cctx); | 7110 line = compile_endtry(p, &cctx); |
7121 cctx.ctx_had_return = FALSE; | 7111 cctx.ctx_had_return = FALSE; |
7122 break; | 7112 break; |
7123 case CMD_throw: | 7113 case CMD_throw: |
7124 line = compile_throw(p, &cctx); | 7114 line = compile_throw(p, &cctx); |
7115 break; | |
7116 | |
7117 case CMD_eval: | |
7118 if (compile_expr0(&p, &cctx) == FAIL) | |
7119 goto erret; | |
7120 | |
7121 // drop the return value | |
7122 generate_instr_drop(&cctx, ISN_DROP, 1); | |
7123 | |
7124 line = skipwhite(p); | |
7125 break; | 7125 break; |
7126 | 7126 |
7127 case CMD_echo: | 7127 case CMD_echo: |
7128 case CMD_echon: | 7128 case CMD_echon: |
7129 case CMD_execute: | 7129 case CMD_execute: |