mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4607: sourcing buffer lines may lead to errors for conflicts
Problem: Sourcing buffer lines may lead to errors for conflicts. Solution: Add the ++clear argument. (Yegappan Lakshmanan, closes #9991)
This commit is contained in:
committed by
Bram Moolenaar
parent
e18acb02bb
commit
35dc17634d
@@ -59,6 +59,24 @@ current_script_is_vim9(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
/*
|
||||
* Clear Vim9 script-local variables and functions.
|
||||
*/
|
||||
void
|
||||
clear_vim9_scriptlocal_vars(int sid)
|
||||
{
|
||||
hashtab_T *ht = &SCRIPT_VARS(sid);
|
||||
|
||||
hashtab_free_contents(ht);
|
||||
hash_init(ht);
|
||||
delete_script_functions(sid);
|
||||
|
||||
// old imports and script variables are no longer valid
|
||||
free_imports_and_script_vars(sid);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ":vim9script".
|
||||
*/
|
||||
@@ -103,18 +121,9 @@ ex_vim9script(exarg_T *eap UNUSED)
|
||||
}
|
||||
|
||||
if (si->sn_state == SN_STATE_RELOAD && !found_noclear)
|
||||
{
|
||||
hashtab_T *ht = &SCRIPT_VARS(sid);
|
||||
|
||||
// Reloading a script without the "noclear" argument: clear
|
||||
// script-local variables and functions.
|
||||
hashtab_free_contents(ht);
|
||||
hash_init(ht);
|
||||
delete_script_functions(sid);
|
||||
|
||||
// old imports and script variables are no longer valid
|
||||
free_imports_and_script_vars(sid);
|
||||
}
|
||||
clear_vim9_scriptlocal_vars(sid);
|
||||
si->sn_state = SN_STATE_HAD_COMMAND;
|
||||
|
||||
// Store the prefix with the script, it is used to find exported functions.
|
||||
|
Reference in New Issue
Block a user