Patch 8.2.1480
Problem:    Vim9: skip expression in search() gives error.
Solution:   use tv_get_bool() eval_expr_to_bool(). (closes #6729)
Files:      src/eval.c, src/typval.c, src/proto/typval.pro,
            src/testdir/test_vim9_func.vim


*** ../vim-8.2.1479/src/eval.c  2020-08-17 21:07:17.941045702 +0200
--- src/eval.c  2020-08-18 19:07:37.367438862 +0200
***************
*** 326,332 ****
        *error = TRUE;
        return FALSE;
      }
!     res = (tv_get_number_chk(&rettv, error) != 0);
      clear_tv(&rettv);
      return res;
  }
--- 326,332 ----
        *error = TRUE;
        return FALSE;
      }
!     res = (tv_get_bool_chk(&rettv, error) != 0);
      clear_tv(&rettv);
      return res;
  }
*** ../vim-8.2.1479/src/typval.c        2020-08-17 21:40:59.096286452 +0200
--- src/typval.c        2020-08-18 19:07:17.767544713 +0200
***************
*** 270,275 ****
--- 270,286 ----
  
  }
  
+ /*
+  * Get the boolean value of "varp".  This is like tv_get_number_chk(),
+  * but in Vim9 script accepts Number and Bool.
+  */
+     varnumber_T
+ tv_get_bool_chk(typval_T *varp, int *denote)
+ {
+     return tv_get_bool_or_number_chk(varp, denote, TRUE);
+ 
+ }
+ 
  #ifdef FEAT_FLOAT
      float_T
  tv_get_float(typval_T *varp)
*** ../vim-8.2.1479/src/proto/typval.pro        2020-08-17 21:40:59.096286452 
+0200
--- src/proto/typval.pro        2020-08-18 19:09:02.946967977 +0200
***************
*** 7,12 ****
--- 7,13 ----
  varnumber_T tv_get_number(typval_T *varp);
  varnumber_T tv_get_number_chk(typval_T *varp, int *denote);
  varnumber_T tv_get_bool(typval_T *varp);
+ varnumber_T tv_get_bool_chk(typval_T *varp, int *denote);
  float_T tv_get_float(typval_T *varp);
  char_u *tv_get_string(typval_T *varp);
  char_u *tv_get_string_buf(typval_T *varp, char_u *buf);
*** ../vim-8.2.1479/src/testdir/test_vim9_func.vim      2020-08-17 
22:21:32.751993070 +0200
--- src/testdir/test_vim9_func.vim      2020-08-18 19:09:48.478712328 +0200
***************
*** 1379,1384 ****
--- 1379,1391 ----
    call delete('XTest_silent_echo')
  endfunc
  
+ def Test_search()
+   new
+   setline(1, ['foo', 'bar'])
+   let val = 0
+   assert_equal(2, search('bar', 'W', 0, 0, {-> val == 1}))
+ enddef
+ 
  def Fibonacci(n: number): number
    if n < 2
      return n
*** ../vim-8.2.1479/src/version.c       2020-08-18 13:41:47.215350419 +0200
--- src/version.c       2020-08-18 19:11:03.758282609 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1480,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
235. You start naming your kids Pascal, COBOL, Algol and Fortran.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202008181712.07IHCBQQ1171072%40masaka.moolenaar.net.

Raspunde prin e-mail lui