Skip to content

Commit dd0b287

Browse files
committed
patch 8.2.3210: Vim9: searchpair() sixth argument is compiled
Problem: Vim9: searchpair() sixth argument is compiled. (Yegappan Lakshmanan) Solution: Only compile the fifth argument.
1 parent 88421d6 commit dd0b287

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/testdir/test_vim9_builtin.vim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,9 +2569,17 @@ def Test_searchpair()
25692569
unlet g:caught
25702570

25712571
lines =<< trim END
2572-
echo searchpair("a", "b", "c", "d", "1", "f")
2572+
echo searchpair("a", "b", "c", "d", "f", 33)
25732573
END
2574-
CheckDefAndScriptFailure2(lines, 'E1001:', 'E475:')
2574+
CheckDefAndScriptFailure2(lines, 'E1001: Variable not found: f', 'E475: Invalid argument: d')
2575+
2576+
lines =<< trim END
2577+
def TestPair()
2578+
echo searchpair("a", "b", "c", "d", "1", "f")
2579+
enddef
2580+
defcompile
2581+
END
2582+
CheckScriptSuccess(lines)
25752583

25762584
bwipe!
25772585
enddef

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3210,
758760
/**/
759761
3209,
760762
/**/

src/vim9compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3315,7 +3315,7 @@ compile_arguments(char_u **arg, cctx_T *cctx, int *argcount, int is_searchpair)
33153315
return FAIL;
33163316
++*argcount;
33173317

3318-
if (is_searchpair && *argcount >= 5
3318+
if (is_searchpair && *argcount == 5
33193319
&& cctx->ctx_instr.ga_len == instr_count + 1)
33203320
{
33213321
isn_T *isn = ((isn_T *)cctx->ctx_instr.ga_data) + instr_count;

0 commit comments

Comments
 (0)