diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-06 21:04:17 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:35:21 +0100 |
commit | 32589341a41f49a11e68d5b080271115787f2dc5 (patch) | |
tree | 6987fd5678742f9ce32cc5036c04600b2a612c54 /src | |
parent | daedbd93124e3334a1024b5d2c60e91b7aeb8fc5 (diff) | |
download | rneovim-32589341a41f49a11e68d5b080271115787f2dc5.tar.gz rneovim-32589341a41f49a11e68d5b080271115787f2dc5.tar.bz2 rneovim-32589341a41f49a11e68d5b080271115787f2dc5.zip |
vim-patch:8.1.1828: not strict enough checking syntax of method invocation
Problem: Not strict enough checking syntax of method invocation.
Solution: Check there is no white space inside ->method(.
https://github.com/vim/vim/commit/5184132ec015f5889a3195d911e609d214f06bed
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_method.vim | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4f934fdc70..23a0ef8506 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4134,6 +4134,11 @@ static int eval_method(char_u **const arg, typval_T *const rettv, EMSG2(_(e_missingparen), name); } ret = FAIL; + } else if (ascii_iswhite((*arg)[-1])) { + if (verbose) { + EMSG(_("E274: No white space allowed before parenthesis")); + } + ret = FAIL; } else { ret = eval_func(arg, name, len, rettv, evaluate, &base); } diff --git a/src/nvim/testdir/test_method.vim b/src/nvim/testdir/test_method.vim index 142b259e78..58e86131dc 100644 --- a/src/nvim/testdir/test_method.vim +++ b/src/nvim/testdir/test_method.vim @@ -118,4 +118,14 @@ func Test_method_funcref() delfunc Concat endfunc +func Test_method_syntax() + eval [1, 2, 3] ->sort( ) + eval [1, 2, 3] + \ ->sort( + \ ) + call assert_fails('eval [1, 2, 3]-> sort()', 'E260:') + call assert_fails('eval [1, 2, 3]->sort ()', 'E274:') + call assert_fails('eval [1, 2, 3]-> sort ()', 'E260:') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |