Model: Fix unscoped type names in files with no namespaces in scope

This commit is contained in:
Katy Coe
2020-01-19 02:57:24 +01:00
parent 3f00d2a3ad
commit 7704c9f3d9

View File

@@ -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;
}