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 -- [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/202007132000.06DK01q32838744%40masaka.moolenaar.net.

Raspunde prin e-mail lui