1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

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

@@ -309,14 +309,17 @@ class CSharpLanguage : public ScriptLanguage {
int lang_idx;
Dictionary scripts_metadata;
bool scripts_metadata_invalidated;
// For debug_break and debug_break_parse
int _debug_parse_err_line;
String _debug_parse_err_file;
String _debug_error;
void _load_scripts_metadata();
friend class GDMono;
void _uninitialize_script_bindings();
void _on_scripts_domain_unloaded();
public:
StringNameCache string_names;
@@ -341,9 +344,15 @@ public:
void reload_assemblies(bool p_soft_reload);
#endif
void project_assembly_loaded();
_FORCE_INLINE_ Dictionary get_scripts_metadata_or_nothing() {
return scripts_metadata_invalidated ? Dictionary() : scripts_metadata;
}
_FORCE_INLINE_ const Dictionary &get_scripts_metadata() { return scripts_metadata; }
_FORCE_INLINE_ const Dictionary &get_scripts_metadata() {
if (scripts_metadata_invalidated)
_load_scripts_metadata();
return scripts_metadata;
}
virtual String get_name() const;