summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-07-24 15:44:30 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-24 15:44:30 +0200
commitdd0b287c1ec8314034a2dbb14c4267994c47520c (patch)
treea97d68b7b799f6addb4429acb89acc28c26f405e
parent88421d6dc812a2f3b0eab34740f174c9558cb734 (diff)
patch 8.2.3210: Vim9: searchpair() sixth argument is compiledv8.2.3210
Problem: Vim9: searchpair() sixth argument is compiled. (Yegappan Lakshmanan) Solution: Only compile the fifth argument.
-rw-r--r--src/testdir/test_vim9_builtin.vim12
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c2
3 files changed, 13 insertions, 3 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 6b64823f5f..d983c34e0c 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -2569,9 +2569,17 @@ def Test_searchpair()
unlet g:caught
lines =<< trim END
- echo searchpair("a", "b", "c", "d", "1", "f")
+ echo searchpair("a", "b", "c", "d", "f", 33)
END
- CheckDefAndScriptFailure2(lines, 'E1001:', 'E475:')
+ CheckDefAndScriptFailure2(lines, 'E1001: Variable not found: f', 'E475: Invalid argument: d')
+
+ lines =<< trim END
+ def TestPair()
+ echo searchpair("a", "b", "c", "d", "1", "f")
+ enddef
+ defcompile
+ END
+ CheckScriptSuccess(lines)
bwipe!
enddef
diff --git a/src/version.c b/src/version.c
index 76c6db9bc4..49e4b609c7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3210,
+/**/
3209,
/**/
3208,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 5ec3b3d390..2df5ff4f41 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3315,7 +3315,7 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount, int is_searchpair)
return FAIL;
++*argcount;
- if (is_searchpair && *argcount >= 5
+ if (is_searchpair && *argcount == 5
&& cctx->ctx_instr.ga_len == instr_count + 1)
{
isn_T *isn = ((isn_T *)cctx->ctx_instr.ga_data) + instr_count;