Mercurial > vim
comparison src/vim9compile.c @ 21901:1ebcce655dd3 v8.2.1500
patch 8.2.1500: Vim9: error when using address without a command
Commit: https://github.com/vim/vim/commit/5d72ce69c8783fd8f1a0355c00806c5084010eec
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 20 23:04:06 2020 +0200
patch 8.2.1500: Vim9: error when using address without a command
Problem: Vim9: error when using address without a command.
Solution: Execute the range itself. (closes https://github.com/vim/vim/issues/6747)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 20 Aug 2020 23:15:03 +0200 |
parents | f19ac9b8b011 |
children | 1fc2ffadf412 |
comparison
equal
deleted
inserted
replaced
21900:bcb274fbcd61 | 21901:1ebcce655dd3 |
---|---|
6659 */ | 6659 */ |
6660 cmd = ea.cmd; | 6660 cmd = ea.cmd; |
6661 if (*cmd != '\'' || starts_with_colon) | 6661 if (*cmd != '\'' || starts_with_colon) |
6662 { | 6662 { |
6663 ea.cmd = skip_range(ea.cmd, NULL); | 6663 ea.cmd = skip_range(ea.cmd, NULL); |
6664 if (ea.cmd > cmd && !starts_with_colon) | 6664 if (ea.cmd > cmd) |
6665 { | 6665 { |
6666 emsg(_(e_colon_required_before_a_range)); | 6666 if (!starts_with_colon) |
6667 goto erret; | 6667 { |
6668 emsg(_(e_colon_required_before_a_range)); | |
6669 goto erret; | |
6670 } | |
6671 if (ends_excmd2(line, ea.cmd)) | |
6672 { | |
6673 // A range without a command: jump to the line. | |
6674 // TODO: compile to a more efficient command, possibly | |
6675 // calling parse_cmd_address(). | |
6676 ea.cmdidx = CMD_SIZE; | |
6677 line = compile_exec(line, &ea, &cctx); | |
6678 goto nextline; | |
6679 } | |
6668 } | 6680 } |
6669 } | 6681 } |
6670 p = find_ex_command(&ea, NULL, starts_with_colon ? NULL | 6682 p = find_ex_command(&ea, NULL, starts_with_colon ? NULL |
6671 : (void *(*)(char_u *, size_t, cctx_T *))lookup_local, | 6683 : (void *(*)(char_u *, size_t, cctx_T *))lookup_local, |
6672 &cctx); | 6684 &cctx); |
6843 // Not recognized, execute with do_cmdline_cmd(). | 6855 // Not recognized, execute with do_cmdline_cmd(). |
6844 ea.arg = p; | 6856 ea.arg = p; |
6845 line = compile_exec(line, &ea, &cctx); | 6857 line = compile_exec(line, &ea, &cctx); |
6846 break; | 6858 break; |
6847 } | 6859 } |
6860 nextline: | |
6848 if (line == NULL) | 6861 if (line == NULL) |
6849 goto erret; | 6862 goto erret; |
6850 line = skipwhite(line); | 6863 line = skipwhite(line); |
6851 | 6864 |
6852 if (cctx.ctx_type_stack.ga_len < 0) | 6865 if (cctx.ctx_type_stack.ga_len < 0) |