Skip to content

Commit

Permalink
Further PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
RenderMichael committed Feb 14, 2024
1 parent 5339702 commit 8d53933
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ private static void CheckNamespaceMembers(IEnumerable<INamespaceSymbol> namespac
{
// Get all the potentially externally visible types in the namespace
IEnumerable<INamedTypeSymbol> typeMembers = @namespace.GetTypeMembers().Where(item =>
Equals(item.ContainingAssembly, context.Compilation.Assembly) &&
MatchesConfiguredVisibility(item, context.Options, context.Compilation) &&
!item.IsFileLocal());
Equals(item.ContainingAssembly, context.Compilation.Assembly) &&
MatchesConfiguredVisibility(item, context.Options, context.Compilation) &&
!item.IsFileLocal());

if (typeMembers.Any())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ namespace Analyzer.Utilities.Extensions
{
internal static class INamedTypeSymbolExtensions
{

private static readonly Func<INamedTypeSymbol, bool> s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor<INamedTypeSymbol, bool>(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false);

public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol);

public static IEnumerable<INamedTypeSymbol> GetBaseTypesAndThis(this INamedTypeSymbol type)
{
INamedTypeSymbol current = type;
Expand Down Expand Up @@ -283,9 +288,5 @@ public static bool IsBenchmarkOrXUnitTestAttribute(this INamedTypeSymbol attribu
public static bool IsTopLevelStatementsEntryPointType([NotNullWhen(true)] this INamedTypeSymbol? typeSymbol)
=> typeSymbol is not null &&
typeSymbol.GetMembers().OfType<IMethodSymbol>().Any(m => m.IsTopLevelStatementsEntryPointMethod());

private static readonly Func<INamedTypeSymbol, bool> s_isFileLocal = LightupHelpers.CreateSymbolPropertyAccessor<INamedTypeSymbol, bool>(typeof(INamedTypeSymbol), nameof(IsFileLocal), fallbackResult: false);

public static bool IsFileLocal(this INamedTypeSymbol symbol) => s_isFileLocal(symbol);
}
}

0 comments on commit 8d53933

Please sign in to comment.