mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.3807: Vim9: can call import with star directly
Problem: Vim9: can call import with star directly. Solution: Check that the import used star.
This commit is contained in:
@@ -2001,7 +2001,7 @@ eval_func(
|
|||||||
// Need to make a copy, in case evaluating the arguments makes
|
// Need to make a copy, in case evaluating the arguments makes
|
||||||
// the name invalid.
|
// the name invalid.
|
||||||
s = vim_strsave(s);
|
s = vim_strsave(s);
|
||||||
if (s == NULL || (flags & EVAL_CONSTANT))
|
if (s == NULL || *s == NUL || (flags & EVAL_CONSTANT))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1536,6 +1536,21 @@ def Test_import_star_fails()
|
|||||||
CheckScriptFailure(lines, 'E1047:')
|
CheckScriptFailure(lines, 'E1047:')
|
||||||
|
|
||||||
delete('Xfoo.vim')
|
delete('Xfoo.vim')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def TheFunc()
|
||||||
|
echo 'the func'
|
||||||
|
enddef
|
||||||
|
export var Ref = TheFunc
|
||||||
|
END
|
||||||
|
writefile([], 'Xthat.vim')
|
||||||
|
lines =<< trim END
|
||||||
|
import * as That from './Xthat.vim'
|
||||||
|
That()
|
||||||
|
END
|
||||||
|
CheckDefAndScriptFailure2(lines, 'E1094:', 'E1236: Cannot use That itself')
|
||||||
|
delete('Xthat.vim')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_import_as()
|
def Test_import_as()
|
||||||
|
@@ -1596,7 +1596,16 @@ deref_func_name(
|
|||||||
*lenp = (int)STRLEN(s);
|
*lenp = (int)STRLEN(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
// TODO: what if (import->imp_flags & IMP_FLAGS_STAR)
|
if (import->imp_flags & IMP_FLAGS_STAR)
|
||||||
|
{
|
||||||
|
name[len] = NUL;
|
||||||
|
semsg(_(e_cannot_use_str_itself_it_is_imported_with_star),
|
||||||
|
name);
|
||||||
|
name[len] = cc;
|
||||||
|
*lenp = 0;
|
||||||
|
return (char_u *)""; // just in case
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
|
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
|
||||||
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
|
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
|
||||||
|
@@ -749,6 +749,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 */
|
||||||
|
/**/
|
||||||
|
3807,
|
||||||
/**/
|
/**/
|
||||||
3806,
|
3806,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user