Skip to content

Commit 7eeb273

Browse files
Fix access check for Find-Type with -Not (#26)
1 parent 3a0144c commit 7eeb273

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/ClassExplorer/Filter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ internal enum FilterOptions
3232
ExcludeNot = 1 << 0,
3333

3434
ExcludePipeFilter = 1 << 1,
35+
36+
DoNotInverseNot = 1 << 2,
3537
}

src/ClassExplorer/ReflectionSearch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ protected static bool AggregateFilter(TMemberType member, object? state, bool is
118118

119119
if (filter.Func(member, filter.State))
120120
{
121-
if (not)
121+
if (not && (filter.Options & FilterOptions.DoNotInverseNot) is 0)
122122
{
123123
return false;
124124
}
125125

126126
continue;
127127
}
128128

129-
if (not)
129+
if (not && (filter.Options & FilterOptions.DoNotInverseNot) is 0)
130130
{
131131
continue;
132132
}

src/ClassExplorer/TypeSearch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected override void InitializeFastFilters(List<Filter<Type>> filters, Signat
9292
filters.AddFilter(
9393
new StrongBox<AccessView>(_options.AccessView),
9494
static (type, view) => type.DoesMatchView(view.Value),
95-
WasAccessSpecified ? default : FilterOptions.ExcludeNot | FilterOptions.ExcludePipeFilter);
95+
WasAccessSpecified ? default : FilterOptions.DoNotInverseNot | FilterOptions.ExcludePipeFilter);
9696
}
9797
}
9898

0 commit comments

Comments
 (0)