Patch 8.2.1204

4 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 13, 2020, 4:00:10 PM7/13/20
to vim...@googlegroups.com

Patch 8.2.1204
Problem: Vim9: true and false not recognized in Vim9 script.
Solution: Recognize true and false.
Files: src/eval.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.1203/src/eval.c 2020-07-13 21:27:58.897307235 +0200
--- src/eval.c 2020-07-13 21:58:08.715698952 +0200
***************
*** 3079,3086 ****
else if (flags & EVAL_CONSTANT)
ret = FAIL;
else if (evaluate)
! // get value of variable
! ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE);
else
{
// skip the name
--- 3079,3100 ----
else if (flags & EVAL_CONSTANT)
ret = FAIL;
else if (evaluate)
! {
! // get the value of "true", "false" or a variable
! if (len == 4 && in_vim9script() && STRNCMP(s, "true", 4) == 0)
! {
! rettv->v_type = VAR_BOOL;
! rettv->vval.v_number = VVAL_TRUE;
! }
! else if (len == 5 && in_vim9script()
! && STRNCMP(s, "false", 4) == 0)
! {
! rettv->v_type = VAR_BOOL;
! rettv->vval.v_number = VVAL_FALSE;
! }
! else
! ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE);
! }
else
{
// skip the name
*** ../vim-8.2.1203/src/testdir/test_vim9_expr.vim 2020-07-12 16:32:16.163241486 +0200
--- src/testdir/test_vim9_expr.vim 2020-07-13 21:51:51.176776698 +0200
***************
*** 1024,1029 ****
--- 1024,1042 ----
call CheckDefFailure(['v:none = 22'], 'E46:')
enddef

+ def Test_expr7_special_vim9script()
+ let lines =<< trim END
+ vim9script
+ let t = true
+ let f = false
+ assert_equal(v:true, true)
+ assert_equal(true, t)
+ assert_equal(v:false, false)
+ assert_equal(false, f)
+ END
+ CheckScriptSuccess(lines)
+ enddef
+
def Test_expr7_list()
" list
assert_equal(g:list_empty, [])
*** ../vim-8.2.1203/src/version.c 2020-07-13 21:27:58.897307235 +0200
--- src/version.c 2020-07-13 21:59:07.527532755 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1204,
/**/

--
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages