diff options
Diffstat (limited to 'modules/mono/csharp_script.h')
-rw-r--r-- | modules/mono/csharp_script.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index a31135cd32..40f7ed4552 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -66,6 +66,18 @@ TScriptInstance *cast_script_instance(ScriptInstance *p_inst) { #define CAST_CSHARP_INSTANCE(m_inst) (cast_script_instance<CSharpInstance, CSharpLanguage>(m_inst)) +struct DotNetScriptLookupInfo { + String class_namespace; + String class_name; + GDMonoClass *script_class = nullptr; + + DotNetScriptLookupInfo() {} // Required by HashMap... + + DotNetScriptLookupInfo(const String &p_class_namespace, const String &p_class_name, GDMonoClass *p_script_class) : + class_namespace(p_class_namespace), class_name(p_class_name), script_class(p_script_class) { + } +}; + class CSharpScript : public Script { GDCLASS(CSharpScript, Script); @@ -390,16 +402,15 @@ class CSharpLanguage : public ScriptLanguage { int lang_idx = -1; - Dictionary scripts_metadata; - bool scripts_metadata_invalidated = true; + HashMap<String, DotNetScriptLookupInfo> dotnet_script_lookup_map; + + void lookup_script_for_class(GDMonoClass *p_class); // For debug_break and debug_break_parse int _debug_parse_err_line = -1; String _debug_parse_err_file; String _debug_error; - void _load_scripts_metadata(); - friend class GDMono; void _on_scripts_domain_unloaded(); @@ -436,18 +447,13 @@ public: void reload_assemblies(bool p_soft_reload); #endif - _FORCE_INLINE_ Dictionary get_scripts_metadata_or_nothing() { - return scripts_metadata_invalidated ? Dictionary() : scripts_metadata; - } + _FORCE_INLINE_ ManagedCallableMiddleman *get_managed_callable_middleman() const { return managed_callable_middleman; } - _FORCE_INLINE_ const Dictionary &get_scripts_metadata() { - if (scripts_metadata_invalidated) { - _load_scripts_metadata(); - } - return scripts_metadata; - } + void lookup_scripts_in_assembly(GDMonoAssembly *p_assembly); - _FORCE_INLINE_ ManagedCallableMiddleman *get_managed_callable_middleman() const { return managed_callable_middleman; } + const DotNetScriptLookupInfo *lookup_dotnet_script(const String &p_script_path) const { + return dotnet_script_lookup_map.getptr(p_script_path); + } String get_name() const override; |