summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.h
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-04-26 01:19:54 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-04-26 19:53:44 +0200
commit791e1294c33626adad323f292702221cc09c21cc (patch)
treee344d2e46f30ea1acc0751c3d9a82db7e1e124f6 /modules/mono/csharp_script.h
parentbf1fe11143241446dc0d8b841f46ac5b9ff4e574 (diff)
downloadredot-engine-791e1294c33626adad323f292702221cc09c21cc.tar.gz
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.
Diffstat (limited to 'modules/mono/csharp_script.h')
-rw-r--r--modules/mono/csharp_script.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 050527d52b..fe4eed2e24 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -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;