Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,18 @@ public static void GetManagedName(MethodBase method, out string managedTypeName,
/// </remarks>
public static void GetManagedName(MethodBase method, out string managedTypeName, out string managedMethodName, out string?[] hierarchyValues)
{
GetManagedName(method, out managedTypeName, out managedMethodName);
GetManagedNameAndHierarchy(method, true, out _, out _, out hierarchyValues);
if (!method.IsGenericMethod && ReflectionHelpers.GetReflectedType(method) is { } semanticType && !ReflectionHelpers.IsGenericType(semanticType))
{
// We are dealing with non-generic method in non-generic type.
// So, it doesn't matter what we pass as "useClosedTypes".
// Instead of calling GetManagedNameAndHierarchy that does repeated work, we call it only once.
GetManagedNameAndHierarchy(method, false, out managedTypeName, out managedMethodName, out hierarchyValues);
}
else
{
GetManagedNameAndHierarchy(method, false, out managedTypeName, out managedMethodName, out _);
GetManagedNameAndHierarchy(method, true, out _, out _, out hierarchyValues);
}
}

/// <summary>
Expand Down Expand Up @@ -344,7 +354,7 @@ bool Filter(MemberInfo mbr, object? param)
hierarchies[1] = hierarchies[0];
}

AppendNestedTypeName(b, type, closedType);
AppendNestedTypeName(b, type);
if (closedType)
{
AppendGenericTypeParameters(b, type);
Expand Down Expand Up @@ -456,7 +466,7 @@ private static void NormalizeAndAppendString(StringBuilder b, string name)
b.Append('\'');
}

private static int AppendNestedTypeName(StringBuilder b, Type? type, bool closedType)
private static int AppendNestedTypeName(StringBuilder b, Type? type)
{
if (type is null)
{
Expand All @@ -466,7 +476,7 @@ private static int AppendNestedTypeName(StringBuilder b, Type? type, bool closed
var outerArity = 0;
if (type.IsNested)
{
outerArity = AppendNestedTypeName(b, type.DeclaringType, closedType);
outerArity = AppendNestedTypeName(b, type.DeclaringType);
b.Append('+');
}

Expand Down