Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Oct 7, 2023
1 parent 6f06ce8 commit 563efb6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,31 @@ void IgnoreMember(Type declaringType, string name, ScrubOrIgnore scrubOrIgnore)

internal bool TryGetScrubOrIgnoreByMemberOfType(Type declaringType, string name, [NotNullWhen(true)] out ScrubOrIgnore? scrubOrIgnore)
{
foreach (var typeIgnores in ignoredMembers)
if (ignoredMembers.TryGetValue(declaringType, out var ignores))
{
if (typeIgnores.Key.IsAssignableFrom(declaringType))
if (ignores.TryGetValue(name, out var innerScrubOrIgnore))
{
if (typeIgnores.Value.TryGetValue(name, out var innerScrubOrIgnore))
{
scrubOrIgnore = innerScrubOrIgnore;
return true;
}
scrubOrIgnore = innerScrubOrIgnore;
return true;
}
}

foreach (var (key, value) in ignoredMembers)
{
if (!key.IsAssignableFrom(declaringType))
{
continue;
}

if (!value.TryGetValue(name, out var innerScrubOrIgnore))
{
continue;
}

scrubOrIgnore = innerScrubOrIgnore;
return true;
}

scrubOrIgnore = null;
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void IgnoreMembersWithType<T>()
IgnoreMembersWithType(typeof(T));

public void IgnoreMembersWithType(Type type) =>
ignoredTypes[type]= ScrubOrIgnore.Ignore;
ignoredTypes[type] = ScrubOrIgnore.Ignore;

bool TryGetScrubOrIgnoreByType(Type memberType, [NotNullWhen(true)]out ScrubOrIgnore? scrubOrIgnore)
{
Expand Down

0 comments on commit 563efb6

Please sign in to comment.