mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3411: Vim9: crash when using base name of import
Problem: Vim9: crash when using base name of import. (Naohiro Ono) Solution: Check the import flags. (closes #8843)
This commit is contained in:
parent
89a54b413a
commit
6853c38b78
@ -654,3 +654,5 @@ EXTERN char e_legacy_must_be_followed_by_command[]
|
|||||||
INIT(= N_("E1234: legacy must be followed by a command"));
|
INIT(= N_("E1234: legacy must be followed by a command"));
|
||||||
EXTERN char e_function_reference_is_not_set[]
|
EXTERN char e_function_reference_is_not_set[]
|
||||||
INIT(= N_("E1235: Function reference is not set"));
|
INIT(= N_("E1235: Function reference is not set"));
|
||||||
|
EXTERN char e_cannot_use_str_itself_it_is_imported_with_star[]
|
||||||
|
INIT(= N_("E1236: Cannot use %s itself, it is imported with '*'"));
|
||||||
|
@ -3260,6 +3260,12 @@ set_var_const(
|
|||||||
semsg(_(e_redefining_imported_item_str), name);
|
semsg(_(e_redefining_imported_item_str), name);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
if (import->imp_flags & IMP_FLAGS_STAR)
|
||||||
|
{
|
||||||
|
semsg(_(e_cannot_use_str_itself_it_is_imported_with_star),
|
||||||
|
name);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
sv = ((svar_T *)si->sn_var_vals.ga_data) + import->imp_var_vals_idx;
|
sv = ((svar_T *)si->sn_var_vals.ga_data) + import->imp_var_vals_idx;
|
||||||
|
|
||||||
where.wt_variable = TRUE;
|
where.wt_variable = TRUE;
|
||||||
|
@ -1477,6 +1477,21 @@ def Test_vim9_import_export()
|
|||||||
delete('Xvim9_script')
|
delete('Xvim9_script')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_import_star_fails()
|
||||||
|
writefile([], 'Xfoo.vim')
|
||||||
|
var lines =<< trim END
|
||||||
|
import * as foo from '/tmp/foo.vim'
|
||||||
|
foo = 'bar'
|
||||||
|
END
|
||||||
|
CheckDefAndScriptFailure2(lines, 'E1094:', 'E1236: Cannot use foo itself')
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
import * as foo from '/tmp/foo.vim'
|
||||||
|
var that = foo
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1029: Expected ''.''')
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_import_as()
|
def Test_import_as()
|
||||||
var export_lines =<< trim END
|
var export_lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3411,
|
||||||
/**/
|
/**/
|
||||||
3410,
|
3410,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user