]> granicus.if.org Git - vim/commitdiff
patch 8.2.3210: Vim9: searchpair() sixth argument is compiled v8.2.3210
authorBram Moolenaar <Bram@vim.org>
Sat, 24 Jul 2021 13:44:30 +0000 (15:44 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 24 Jul 2021 13:44:30 +0000 (15:44 +0200)
Problem:    Vim9: searchpair() sixth argument is compiled. (Yegappan
            Lakshmanan)
Solution:   Only compile the fifth argument.

src/testdir/test_vim9_builtin.vim
src/version.c
src/vim9compile.c

index 6b64823f5f1dbe993e1b77444b9904b96a581100..d983c34e0c3cf9bd5526c0130705b0ef4c7b88a6 100644 (file)
@@ -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
index 76c6db9bc4024bace033c875fdff81c3189559cb..49e4b609c788a998abdf243bb63a469d6ed4e9ed 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3210,
 /**/
     3209,
 /**/
index 5ec3b3d3908927aa74603e43c2015d413e1f950b..2df5ff4f413d709a4970f5a0651027969dd2d6d9 100644 (file)
@@ -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;