To: vim_dev@googlegroups.com Subject: Patch 8.2.4277 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4277 Problem: Vim9: an import does not shadow a command modifier. Solution: Do not accept a command modifier followed by a dot. Files: src/ex_docmd.c, src/testdir/test_vim9_import.vim *** ../vim-8.2.4276/src/ex_docmd.c 2022-01-29 15:19:19.546172430 +0000 --- src/ex_docmd.c 2022-01-31 18:55:30.079348116 +0000 *************** *** 2709,2715 **** /* * Check for an Ex command with optional tail. * If there is a match advance "pp" to the argument and return TRUE. ! * If "noparen" is TRUE do not recognize the command followed by "(". */ static int checkforcmd_opt( --- 2709,2715 ---- /* * Check for an Ex command with optional tail. * If there is a match advance "pp" to the argument and return TRUE. ! * If "noparen" is TRUE do not recognize the command followed by "(" or ".". */ static int checkforcmd_opt( *************** *** 2723,2730 **** for (i = 0; cmd[i] != NUL; ++i) if (((char_u *)cmd)[i] != (*pp)[i]) break; ! if (i >= len && !isalpha((*pp)[i]) ! && (*pp)[i] != '_' && (!noparen || (*pp)[i] != '(')) { *pp = skipwhite(*pp + i); return TRUE; --- 2723,2730 ---- for (i = 0; cmd[i] != NUL; ++i) if (((char_u *)cmd)[i] != (*pp)[i]) break; ! if (i >= len && !isalpha((*pp)[i]) && (*pp)[i] != '_' ! && (!noparen || ((*pp)[i] != '(' && (*pp)[i] != '.'))) { *pp = skipwhite(*pp + i); return TRUE; *************** *** 2746,2752 **** } /* ! * Check for an Ex command with optional tail, not followed by "(". * If there is a match advance "pp" to the argument and return TRUE. */ int --- 2746,2752 ---- } /* ! * Check for an Ex command with optional tail, not followed by "(" or ".". * If there is a match advance "pp" to the argument and return TRUE. */ int *** ../vim-8.2.4276/src/testdir/test_vim9_import.vim 2022-01-30 18:40:40.535255817 +0000 --- src/testdir/test_vim9_import.vim 2022-01-31 18:54:39.692091224 +0000 *************** *** 142,147 **** --- 142,155 ---- unlet g:imported_func delete('Ximport_lbr.vim') + var import_shadows_cmdmod_lines =<< trim END + vim9script + import './Xexport.vim' as vim9 + vim9.exp_name = 'Shadow' + assert_equal('Shadow', vim9.exp_name) + END + v9.CheckScriptSuccess(import_shadows_cmdmod_lines) + var line_break_before_dot =<< trim END vim9script import './Xexport.vim' as expo *************** *** 365,371 **** assert_fails('source Ximport.vim', 'E46: Cannot change read-only variable "CONST"', '', 3) delete('Ximport.vim') - delete('Ximport3.vim') delete('Xexport.vim') # Check that in a Vim9 script 'cpo' is set to the Vim default. --- 373,378 ---- *** ../vim-8.2.4276/src/version.c 2022-01-31 17:39:45.394105533 +0000 --- src/version.c 2022-01-31 18:24:23.455077073 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4277, /**/ -- I have read and understood the above. X________________ /// 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 ///