To: vim_dev@googlegroups.com Subject: Patch 8.2.1325 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1325 Problem: Vim9: using Vim9 script for autaload not tested. Solution: Add a test. Update help. Files: runtime/doc/vim9.txt, src/testdir/test_autoload.vim, src/testdir/sautest/autoload/auto9.vim *** ../vim-8.2.1324/runtime/doc/vim9.txt 2020-07-28 20:06:46.111280310 +0200 --- runtime/doc/vim9.txt 2020-07-29 22:06:30.138600378 +0200 *************** *** 118,126 **** *vim9-scopes* When using `:function` or `:def` to specify a new function at the script level in a Vim9 script, the function is local to the script, as if "s:" was ! prefixed. Using the "s:" prefix is optional. ! ! To define or use a global function or variable the "g:" prefix must be used. When using `:function` or `:def` to specify a new function inside a function, the function is local to the function. It is not possible to define a --- 118,130 ---- *vim9-scopes* When using `:function` or `:def` to specify a new function at the script level in a Vim9 script, the function is local to the script, as if "s:" was ! prefixed. Using the "s:" prefix is optional. To define or use a global ! function or variable the "g:" prefix must be used. For functions in an ! autoload script the "name#" prefix is sufficient. > ! def ThisFunction() # script-local ! def s:ThisFunction() # script-local ! def g:ThatFunction() # global ! def scriptname#function() # autoload When using `:function` or `:def` to specify a new function inside a function, the function is local to the function. It is not possible to define a *** ../vim-8.2.1324/src/testdir/test_autoload.vim 2019-08-04 22:44:15.000000000 +0200 --- src/testdir/test_autoload.vim 2020-07-29 22:03:07.939542507 +0200 *************** *** 17,19 **** --- 17,24 ---- source sautest/autoload/sourced.vim call assert_equal(1, g:loaded_sourced_vim) endfunc + + func Test_autoload_vim9script() + call assert_equal('some', auto9#getsome()) + call assert_equal(49, auto9#add42(7)) + endfunc *** ../vim-8.2.1324/src/testdir/sautest/autoload/auto9.vim 2020-07-29 22:10:26.769686867 +0200 --- src/testdir/sautest/autoload/auto9.vim 2020-07-29 22:03:06.395549682 +0200 *************** *** 0 **** --- 1,9 ---- + vim9script + + func auto9#getsome() + return 'some' + endfunc + + def auto9#add42(count: number): number + return count + 42 + enddef *** ../vim-8.2.1324/src/version.c 2020-07-29 21:37:39.793716241 +0200 --- src/version.c 2020-07-29 22:01:11.140082703 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1325, /**/ -- I AM THANKFUL... ...for the taxes that I pay because it means that I am employed. /// Bram Moolenaar -- Bram@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 ///