summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:48:18 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:48:18 +0100
commit3bbf4abfaa51848b6d18ad9f4c559973faee3cef (patch)
tree47334afa84b74e06a131d708893be15edf894b5c /modules/mono/csharp_script.cpp
parent31baf464b377636dbdcb5c6b24379bc6470750d3 (diff)
parent18599c0935571aeede87198d943c4da13b2ad389 (diff)
downloadredot-engine-3bbf4abfaa51848b6d18ad9f4c559973faee3cef.tar.gz
Merge pull request #87550 from zaevi/fix_csharp_generic_reloading
C#: Fix sorting for generic types when reloading assemblies.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 0ee2ad25b5..33fef2d58c 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -697,19 +697,25 @@ struct CSharpScriptDepSort {
// Shouldn't happen but just in case...
return false;
}
- const Script *I = B->get_base_script().ptr();
+ const CSharpScript *I = get_base_script(B.ptr()).ptr();
while (I) {
if (I == A.ptr()) {
// A is a base of B
return true;
}
- I = I->get_base_script().ptr();
+ I = get_base_script(I).ptr();
}
// A isn't a base of B
return false;
}
+
+ // Special fix for constructed generic types.
+ Ref<CSharpScript> get_base_script(const CSharpScript *p_script) const {
+ Ref<CSharpScript> base_script = p_script->base_script;
+ return base_script.is_valid() && !base_script->class_name.is_empty() ? base_script : nullptr;
+ }
};
void CSharpLanguage::reload_all_scripts() {