Skip to content

Commit

Permalink
perf(codegen): do not iterate through Object class's members
Browse files Browse the repository at this point in the history
  • Loading branch information
jonisavo committed Sep 21, 2023
1 parent 9489002 commit b562ca7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static bool HasBaseType(INamedTypeSymbol type, INamedTypeSymbol desiredBa
{
var current = type;

while (current != null)
while (current != null && current.SpecialType != SpecialType.System_Object)
{
if (current.Equals(desiredBaseType, SymbolEqualityComparer.Default))
return true;
Expand Down Expand Up @@ -177,7 +177,7 @@ public static IEnumerable<ISymbol> GetAllMembersOfType(ITypeSymbol typeSymbol)
{
var current = typeSymbol;

while (current != null)
while (current != null && current.SpecialType != SpecialType.System_Object)
{
foreach (var member in current.GetMembers())
yield return member;
Expand All @@ -190,7 +190,7 @@ public static IEnumerable<AttributeData> GetAllAttributesOfType(ITypeSymbol type
{
var current = typeSymbol;

while (current != null)
while (current != null && current.SpecialType != SpecialType.System_Object)
{
foreach (var attribute in current.GetAttributes())
yield return attribute;
Expand Down

0 comments on commit b562ca7

Please sign in to comment.