mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.4174: Vim9: can use an autoload name in normal script
Problem: Vim9: can use an autoload name in normal script. Solution: Disallow using an autoload name.
This commit is contained in:
@@ -3209,7 +3209,8 @@ EXTERN char e_cannot_import_dot_vim_without_using_as[]
|
||||
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
|
||||
EXTERN char e_cannot_import_same_script_twice_str[]
|
||||
INIT(= N_("E1262: Cannot import the same script twice: %s"));
|
||||
// E1263 unused
|
||||
EXTERN char e_using_autoload_name_in_non_autoload_script_str[]
|
||||
INIT(= N_("E1263: Using autoload name in a non-autoload script: %s"));
|
||||
EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
|
||||
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: %s"));
|
||||
EXTERN char e_cannot_use_partial_here[]
|
||||
|
@@ -1622,6 +1622,18 @@ def Test_autoload_missing_function_name()
|
||||
delete('Xdir', 'rf')
|
||||
enddef
|
||||
|
||||
def Test_autoload_name_wring()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Xscriptname#Func()
|
||||
enddef
|
||||
END
|
||||
writefile(lines, 'Xscriptname.vim')
|
||||
CheckScriptFailure(lines, 'E1263:')
|
||||
|
||||
delete('Xscriptname')
|
||||
enddef
|
||||
|
||||
def Test_import_autoload_postponed()
|
||||
mkdir('Xdir/autoload', 'p')
|
||||
var save_rtp = &rtp
|
||||
|
@@ -4495,6 +4495,12 @@ define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (vim9script && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
|
||||
{
|
||||
semsg(_(e_using_autoload_name_in_non_autoload_script_str),
|
||||
name);
|
||||
goto erret;
|
||||
}
|
||||
}
|
||||
if (var_conflict)
|
||||
{
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4174,
|
||||
/**/
|
||||
4173,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user