To: vim_dev@googlegroups.com Subject: Patch 8.2.4323 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4323 Problem: Vim9: nested function name can start with "_". Solution: Use same rule for function name for nested functions. (closes #9713) Files: src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.4322/src/vim9compile.c 2022-02-06 20:28:08.791367997 +0000 --- src/vim9compile.c 2022-02-07 20:12:04.805159466 +0000 *************** *** 886,891 **** --- 886,896 ---- } if (check_defined(name_start, name_end - name_start, cctx, FALSE) == FAIL) return NULL; + if (!ASCII_ISUPPER(is_global ? name_start[2] : name_start[0])) + { + semsg(_(e_function_name_must_start_with_capital_or_s_str), name_start); + return NULL; + } eap->arg = name_end; fill_exarg_from_cctx(eap, cctx); *** ../vim-8.2.4322/src/testdir/test_vim9_func.vim 2022-02-07 19:56:38.887286140 +0000 --- src/testdir/test_vim9_func.vim 2022-02-07 20:22:01.751947636 +0000 *************** *** 679,684 **** --- 679,708 ---- assert_equal('ok', g:result) unlet g:result + lines =<< trim END + vim9script + def Outer() + def _Inner() + echo 'bad' + enddef + Inner() + enddef + defcompile + END + v9.CheckScriptFailure(lines, 'E128:') + + lines =<< trim END + vim9script + def Outer() + def g:inner() + echo 'bad' + enddef + Inner() + enddef + defcompile + END + v9.CheckScriptFailure(lines, 'E128:') + # nested function inside conditional lines =<< trim END vim9script *************** *** 3135,3145 **** def Iter(container: any): any var idx = -1 var obj = {state: container} ! def g:__NextItem__(self: dict): any ++idx return self.state[idx] enddef ! obj.__next__ = function('g:__NextItem__', [obj]) return obj enddef --- 3159,3169 ---- def Iter(container: any): any var idx = -1 var obj = {state: container} ! def g:NextItem__(self: dict): any ++idx return self.state[idx] enddef ! obj.__next__ = function('g:NextItem__', [obj]) return obj enddef *** ../vim-8.2.4322/src/version.c 2022-02-07 19:56:38.887286140 +0000 --- src/version.c 2022-02-07 20:05:43.274004985 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4323, /**/ -- hundred-and-one symptoms of being an internet addict: 25. You believe nothing looks sexier than a man in boxer shorts illuminated only by a 17" inch svga monitor. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///