To: vim_dev@googlegroups.com Subject: Patch 8.2.0731 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0731 Problem: Vim9: parsing declarations continues after :finish. Solution: Bail out when encountering :finish. Files: src/vim9script.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.0730/src/vim9script.c 2020-05-09 22:50:04.751323784 +0200 --- src/vim9script.c 2020-05-10 21:14:58.503672051 +0200 *************** *** 130,135 **** --- 130,141 ---- vim_free(((char_u **)(gap->ga_data))[--gap->ga_len]); ((char_u **)(gap->ga_data))[gap->ga_len++] = NULL; } + else if (checkforcmd(&p, "finish", 4)) + { + // TODO: this should not happen below "if false". + // Use "if cond | finish | endif as a workaround. + break; + } } // Compile the :def functions. *** ../vim-8.2.0730/src/testdir/test_vim9_script.vim 2020-05-10 19:10:27.972996530 +0200 --- src/testdir/test_vim9_script.vim 2020-05-10 21:19:11.250737326 +0200 *************** *** 1705,1710 **** --- 1705,1727 ---- ], 'E488:') enddef + def Test_finish() + let lines =<< trim END + vim9script + let g:res = 'one' + if v:false | finish | endif + let g:res = 'two' + finish + let g:res = 'three' + END + writefile(lines, 'Xfinished') + source Xfinished + assert_equal('two', g:res) + + unlet g:res + delete('Xfinished') + enddef + " Keep this last, it messes up highlighting. def Test_substitute_cmd() new *** ../vim-8.2.0730/src/version.c 2020-05-10 19:10:27.972996530 +0200 --- src/version.c 2020-05-10 21:17:05.035201685 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 731, /**/ -- From "know your smileys": ¯\_(ツ)_/¯ Shrug /// 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 ///