Skip to content

Commit

Permalink
Fixup of extraction.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnebel committed Nov 28, 2024
1 parent 1e2405e commit a96a3c2
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,23 @@ public static bool IsPublicOrProtected(this ISymbol symbol) =>
/// <summary>
/// Returns true if the given symbol should be extracted in this context.
/// </summary>
public static bool ShouldExtractSymbol(this ISymbol symbol) =>
symbol.Locations.Any(x => !x.IsInMetadata) || symbol.IsPublicOrProtected();
public static bool ShouldExtractSymbol(this ISymbol symbol)
{
// Extract all source symbols and public/protected metadata symbols.
if (symbol.Locations.Any(x => !x.IsInMetadata) || symbol.IsPublicOrProtected())
{
return true;
}
if (symbol is IMethodSymbol method)
{
return method.ExplicitInterfaceImplementations.Any(m => m.ContainingType.DeclaredAccessibility == Accessibility.Public);
}
if (symbol is IPropertySymbol property)
{
return property.ExplicitInterfaceImplementations.Any(m => m.ContainingType.DeclaredAccessibility == Accessibility.Public);
}
return false;
}

/// <summary>
/// Returns the symbols that should be extracted in the given context.
Expand Down

0 comments on commit a96a3c2

Please sign in to comment.