Mercurial > vim
diff src/vim9compile.c @ 20982:bb49b5090a9c v8.2.1042
patch 8.2.1042: Vim9: cannot put an operator on the next line
Commit: https://github.com/vim/vim/commit/df069eec3b90401e880e9b0e258146d8f36c474d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 22 23:02:51 2020 +0200
patch 8.2.1042: Vim9: cannot put an operator on the next line
Problem: Vim9: cannot put an operator on the next line.
Solution: Require a colon before a range to see if that causes problems.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 22 Jun 2020 23:15:04 +0200 |
parents | d561e3c6cd65 |
children | ae4b1d497a06 |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -643,7 +643,7 @@ check_number_or_float(vartype_T type1, v || type2 == VAR_ANY))) { if (*op == '+') - emsg(_("E1035: wrong argument type for +")); + emsg(_("E1051: wrong argument type for +")); else semsg(_("E1036: %c requires number or float arguments"), *op); return FAIL; @@ -6695,6 +6695,7 @@ compile_def_function(ufunc_T *ufunc, int { exarg_T ea; int starts_with_colon = FALSE; + char_u *cmd; // Bail out on the first error to avoid a flood of errors and report // the right line number when inside try/catch. @@ -6853,7 +6854,13 @@ compile_def_function(ufunc_T *ufunc, int /* * COMMAND after range */ + cmd = ea.cmd; ea.cmd = skip_range(ea.cmd, NULL); + if (ea.cmd > cmd && !starts_with_colon) + { + emsg(_(e_colon_required)); + goto erret; + } p = find_ex_command(&ea, NULL, starts_with_colon ? NULL : (void *(*)(char_u *, size_t, cctx_T *))lookup_local, &cctx); @@ -7008,8 +7015,9 @@ compile_def_function(ufunc_T *ufunc, int line = compile_mult_expr(p, ea.cmdidx, &cctx); break; + // TODO: other commands with an expression argument + default: - // TODO: other commands with an expression argument // Not recognized, execute with do_cmdline_cmd(). ea.arg = p; line = compile_exec(line, &ea, &cctx);