Patch 8.2.3965
Problem:    Vim9: no easy way to check if Vim9 script is supported.
Solution:   Add has('vim9script').
Files:      runtime/doc/vim9.txt, src/evalfunc.c,
            src/testdir/test_vim9_script.vim


*** ../vim-8.2.3964/runtime/doc/vim9.txt        2021-12-27 15:39:23.722764882 
+0000
--- runtime/doc/vim9.txt        2022-01-01 11:57:30.590343560 +0000
***************
*** 391,398 ****
          endif
        enddef
  
! If you would do it like this you get an error at compile time that
! "PluginFunc" does not exist, even when "g:loaded_plugin" does not exist: >
        def CallPluginFunc()
          if exists('g:loaded_plugin')
            PluginFunc()   # Error - function not found
--- 391,398 ----
          endif
        enddef
  
! If you do it like this, you get an error at compile time that "PluginFunc"
! does not exist, even when "g:loaded_plugin" does not exist: >
        def CallPluginFunc()
          if exists('g:loaded_plugin')
            PluginFunc()   # Error - function not found
***************
*** 1411,1419 ****
  2. The "if" statement evaluates to true, the commands up to `endif` are
     executed and `finish` bails out before reaching `vim9script`.
  
- TODO: The "vim9script" feature does not exist yet, it will only be added once
- the Vim9 script syntax has been fully implemented.
- 
  
  Export ~
                                                        *:export* *:exp*
--- 1411,1416 ----
*** ../vim-8.2.3964/src/evalfunc.c      2021-12-31 22:48:56.575368905 +0000
--- src/evalfunc.c      2022-01-01 11:54:46.078533993 +0000
***************
*** 5929,5934 ****
--- 5929,5935 ----
                0
  #endif
                },
+       {"vim9script", 1},
        {"vimscript-1", 1},
        {"vimscript-2", 1},
        {"vimscript-3", 1},
*** ../vim-8.2.3964/src/testdir/test_vim9_script.vim    2021-12-26 
12:07:24.798944010 +0000
--- src/testdir/test_vim9_script.vim    2022-01-01 12:00:13.870101123 +0000
***************
*** 7,12 ****
--- 7,29 ----
  source shared.vim
  source screendump.vim
  
+ def Test_vim9script_feature()
+   # example from the help, here the feature is always present
+   var lines =<< trim END
+       " old style comment
+       if !has('vim9script')
+         " legacy commands would go here
+         finish
+       endif
+       vim9script
+       # Vim9 script commands go here
+       g:didit = true
+   END
+   CheckScriptSuccess(lines)
+   assert_equal(true, g:didit)
+   unlet g:didit
+ enddef
+ 
  def Test_range_only()
    new
    setline(1, ['blah', 'Blah'])
*** ../vim-8.2.3964/src/version.c       2022-01-01 11:38:32.412349129 +0000
--- src/version.c       2022-01-01 12:02:22.961881491 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3965,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
175. You send yourself e-mail before you go to bed to remind you
     what to do when you wake up.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220101121741.88B701C0A5B%40moolenaar.net.

Raspunde prin e-mail lui