Commit:
a1f390fParent:
85a08ddUse a "canonical" form for member symbols
Core/ReachabilityAnalyzer.cs
+9
-0
diff --git a/Core/ReachabilityAnalyzer.cs b/Core/ReachabilityAnalyzer.cs
index 3cd9b39..4d350de 100644
@@ -16,6 +16,8 @@ internal sealed class ReachabilityAnalyzer(IReadOnlyCollection<Compilation> comp
public void Analyze(ISymbol member, CancellationToken cancellationToken)
{
member = GetCanonicalMemberSymbol(member);
if (
!IsUserDefined(member)
|| !TryGetAssociatedCompilation(member, out var compilation)
@@ -31,6 +33,13 @@ internal sealed class ReachabilityAnalyzer(IReadOnlyCollection<Compilation> comp
}
}
private static ISymbol GetCanonicalMemberSymbol(ISymbol member) =>
member switch
{
IMethodSymbol { ReducedFrom: ISymbol unreduced } => unreduced,
_ => member,
};
private static bool IsUserDefined(ISymbol member) =>
!member.IsImplicitlyDeclared && (member.CanBeReferencedByName || member.Name is "<Main>$");