mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4277: Vim9: an import does not shadow a command modifier
Problem: Vim9: an import does not shadow a command modifier. Solution: Do not accept a command modifier followed by a dot.
This commit is contained in:
parent
9e0208f51c
commit
68854a82fd
@ -2709,7 +2709,7 @@ ex_range_without_command(exarg_T *eap)
|
|||||||
/*
|
/*
|
||||||
* Check for an Ex command with optional tail.
|
* Check for an Ex command with optional tail.
|
||||||
* If there is a match advance "pp" to the argument and return TRUE.
|
* If there is a match advance "pp" to the argument and return TRUE.
|
||||||
* If "noparen" is TRUE do not recognize the command followed by "(".
|
* If "noparen" is TRUE do not recognize the command followed by "(" or ".".
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
checkforcmd_opt(
|
checkforcmd_opt(
|
||||||
@ -2723,8 +2723,8 @@ checkforcmd_opt(
|
|||||||
for (i = 0; cmd[i] != NUL; ++i)
|
for (i = 0; cmd[i] != NUL; ++i)
|
||||||
if (((char_u *)cmd)[i] != (*pp)[i])
|
if (((char_u *)cmd)[i] != (*pp)[i])
|
||||||
break;
|
break;
|
||||||
if (i >= len && !isalpha((*pp)[i])
|
if (i >= len && !isalpha((*pp)[i]) && (*pp)[i] != '_'
|
||||||
&& (*pp)[i] != '_' && (!noparen || (*pp)[i] != '('))
|
&& (!noparen || ((*pp)[i] != '(' && (*pp)[i] != '.')))
|
||||||
{
|
{
|
||||||
*pp = skipwhite(*pp + i);
|
*pp = skipwhite(*pp + i);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2746,7 +2746,7 @@ checkforcmd(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for an Ex command with optional tail, not followed by "(".
|
* 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.
|
* If there is a match advance "pp" to the argument and return TRUE.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -142,6 +142,14 @@ def Test_vim9_import_export()
|
|||||||
unlet g:imported_func
|
unlet g:imported_func
|
||||||
delete('Ximport_lbr.vim')
|
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
|
var line_break_before_dot =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
import './Xexport.vim' as expo
|
import './Xexport.vim' as expo
|
||||||
@ -365,7 +373,6 @@ def Test_vim9_import_export()
|
|||||||
assert_fails('source Ximport.vim', 'E46: Cannot change read-only variable "CONST"', '', 3)
|
assert_fails('source Ximport.vim', 'E46: Cannot change read-only variable "CONST"', '', 3)
|
||||||
|
|
||||||
delete('Ximport.vim')
|
delete('Ximport.vim')
|
||||||
delete('Ximport3.vim')
|
|
||||||
delete('Xexport.vim')
|
delete('Xexport.vim')
|
||||||
|
|
||||||
# Check that in a Vim9 script 'cpo' is set to the Vim default.
|
# Check that in a Vim9 script 'cpo' is set to the Vim default.
|
||||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4277,
|
||||||
/**/
|
/**/
|
||||||
4276,
|
4276,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user