From 7704c9f3d9051cb3aa9804fa85d6ea5b08378746 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 19 Jan 2020 02:57:24 +0100 Subject: [PATCH] Model: Fix unscoped type names in files with no namespaces in scope --- Il2CppInspector/Reflection/TypeInfo.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector/Reflection/TypeInfo.cs b/Il2CppInspector/Reflection/TypeInfo.cs index 1b8867b..603298c 100644 --- a/Il2CppInspector/Reflection/TypeInfo.cs +++ b/Il2CppInspector/Reflection/TypeInfo.cs @@ -276,11 +276,16 @@ namespace Il2CppInspector.Reflection { if (Assembly.Model.TypesByFullName.ContainsKey(outerTypeName)) matchingNamespaces.Add(""); - // More than one possible matching type? If so, the type reference is ambiguous + // More than one possible matching namespace? If so, the type reference is ambiguous if (matchingNamespaces.Count > 1) { // TODO: This can be improved to cut off a new mutual root that doesn't cause ambiguity minimallyScopedName = usedType; } + + // No matching namespaces, not hidden, no mutual root scope in the file and no using directive? + // If so, the type's namespace is completely out of scope so use the fully-qualified type name + if (matchingNamespaces.Count == 0 && !hidden && string.IsNullOrEmpty(mutualRootScope) && usingDirective == null) + minimallyScopedName = usedType; } return minimallyScopedName; }