• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision0afa30d6dc7227e8d7a5153220a96add31adef87 (tree)
Zeit2020-10-19 01:15:03
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1861: Vim9: no specific error when parsing lambda fails

Commit: https://github.com/vim/vim/commit/a2c026d0fd470d68d679616fddfc285cb4834412
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 18 18:03:17 2020 +0200

patch 8.2.1861: Vim9: no specific error when parsing lambda fails
Problem: Vim9: no specific error when parsing lambda fails.
Solution: Also give syntax errors when not evaluating. (closes https://github.com/vim/vim/issues/7154)

Ändern Zusammenfassung

Diff

diff -r d2b721a599f9 -r 0afa30d6dc72 src/dict.c
--- a/src/dict.c Sat Oct 17 23:00:04 2020 +0200
+++ b/src/dict.c Sun Oct 18 18:15:03 2020 +0200
@@ -860,13 +860,10 @@
860860 *arg = skipwhite(*arg);
861861 if (**arg != ':')
862862 {
863- if (evaluate)
864- {
865- if (*skipwhite(*arg) == ':')
866- semsg(_(e_no_white_space_allowed_before_str), ":");
867- else
868- semsg(_(e_missing_dict_colon), *arg);
869- }
863+ if (*skipwhite(*arg) == ':')
864+ semsg(_(e_no_white_space_allowed_before_str), ":");
865+ else
866+ semsg(_(e_missing_dict_colon), *arg);
870867 clear_tv(&tvkey);
871868 goto failret;
872869 }
@@ -899,8 +896,7 @@
899896 item = dict_find(d, key, -1);
900897 if (item != NULL)
901898 {
902- if (evaluate)
903- semsg(_(e_duplicate_key), key);
899+ semsg(_(e_duplicate_key), key);
904900 clear_tv(&tvkey);
905901 clear_tv(&tv);
906902 goto failret;
@@ -937,21 +933,17 @@
937933 break;
938934 if (!had_comma)
939935 {
940- if (evaluate)
941- {
942- if (**arg == ',')
943- semsg(_(e_no_white_space_allowed_before_str), ",");
944- else
945- semsg(_(e_missing_dict_comma), *arg);
946- }
936+ if (**arg == ',')
937+ semsg(_(e_no_white_space_allowed_before_str), ",");
938+ else
939+ semsg(_(e_missing_dict_comma), *arg);
947940 goto failret;
948941 }
949942 }
950943
951944 if (**arg != '}')
952945 {
953- if (evaluate)
954- semsg(_(e_missing_dict_end), *arg);
946+ semsg(_(e_missing_dict_end), *arg);
955947 failret:
956948 if (d != NULL)
957949 dict_free(d);
diff -r d2b721a599f9 -r 0afa30d6dc72 src/testdir/test_vim9_expr.vim
--- a/src/testdir/test_vim9_expr.vim Sat Oct 17 23:00:04 2020 +0200
+++ b/src/testdir/test_vim9_expr.vim Sun Oct 18 18:15:03 2020 +0200
@@ -1805,6 +1805,13 @@
18051805 CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x', 'y')"],
18061806 'E1106: 2 arguments too many')
18071807 CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1)
1808+
1809+ CheckDefSuccess(['var Fx = {a -> #{k1: 0,', ' k2: 1}}'])
1810+ CheckDefFailure(['var Fx = {a -> #{k1: 0', ' k2: 1}}'], 'E722:', 2)
1811+ CheckDefFailure(['var Fx = {a -> #{k1: 0,', ' k2 1}}'], 'E720:', 2)
1812+
1813+ CheckDefSuccess(['var Fx = {a -> [0,', ' 1]}'])
1814+ CheckDefFailure(['var Fx = {a -> [0', ' 1]}'], 'E696:', 2)
18081815 enddef
18091816
18101817 def Test_expr7_lambda_vim9script()
@@ -2371,7 +2378,7 @@
23712378 call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1)
23722379
23732380 call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2)
2374- call CheckDefExecFailure(["#{a: 1->len()"], 'E488:', 1)
2381+ call CheckDefExecFailure(["#{a: 1->len()"], 'E722:', 1)
23752382 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:', 2)
23762383 endfunc
23772384
diff -r d2b721a599f9 -r 0afa30d6dc72 src/version.c
--- a/src/version.c Sat Oct 17 23:00:04 2020 +0200
+++ b/src/version.c Sun Oct 18 18:15:03 2020 +0200
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 1861,
755+/**/
754756 1860,
755757 /**/
756758 1859,
Show on old repository browser