patch 8.2.2485: when sourcing a script again the script version isn't reset
Problem: When sourcing a script again the script version isn't reset.
Solution: Set sn_version to one when sourcing a script again. Clear
sn_save_cpo properly. (closes #7608)
diff --git a/src/scriptfile.c b/src/scriptfile.c
index c8a23d5..82ae42a 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1319,6 +1319,9 @@
}
// imports can be redefined once
mark_imports_for_reload(sid);
+
+ // reset version, "vim9script" may have been added or removed.
+ si->sn_version = 1;
}
else
{
@@ -1457,7 +1460,7 @@
if (si->sn_save_cpo != NULL)
{
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
- CLEAR_POINTER(si->sn_save_cpo);
+ VIM_CLEAR(si->sn_save_cpo);
}
restore_funccal();