Mono: Lazily load scripts metadata file

- Only load the scripts metadata file when it's really needed. This way we avoid false errors, when there is no C# project,  about missing scripts metadata file.
This commit is contained in:
Ignacio Etcheverry 2019-04-26 01:19:54 +02:00
parent bf1fe11143
commit 791e1294c3
4 changed files with 21 additions and 9 deletions

View file

@ -919,7 +919,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
}
#endif
void CSharpLanguage::project_assembly_loaded() {
void CSharpLanguage::_load_scripts_metadata() {
scripts_metadata.clear();
@ -953,6 +953,7 @@ void CSharpLanguage::project_assembly_loaded() {
}
scripts_metadata = old_dict_var.operator Dictionary();
scripts_metadata_invalidated = false;
print_verbose("Successfully loaded scripts metadata");
} else {
@ -1024,11 +1025,13 @@ bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
}
}
void CSharpLanguage::_uninitialize_script_bindings() {
void CSharpLanguage::_on_scripts_domain_unloaded() {
for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
CSharpScriptBinding &script_binding = E->value();
script_binding.inited = false;
}
scripts_metadata_invalidated = true;
}
void CSharpLanguage::set_language_index(int p_idx) {
@ -1086,6 +1089,8 @@ CSharpLanguage::CSharpLanguage() {
#endif
lang_idx = -1;
scripts_metadata_invalidated = true;
}
CSharpLanguage::~CSharpLanguage() {