@@ -22,8 +22,8 @@ namespace CommunityToolkit.Mvvm.SourceGenerators.Models;
2222/// <param name="FilenameHint">The filename hint for the current type.</param>
2323/// <param name="MetadataName">The metadata name for the current type.</param>
2424/// <param name="Namespace">Gets the namespace for the current type.</param>
25- /// <param name="Names ">Gets the sequence of type definitions containing the current type.</param>
26- internal sealed partial record HierarchyInfo ( string FilenameHint , string MetadataName , string Namespace , ImmutableArray < string > Names )
25+ /// <param name="Hierarchy ">Gets the sequence of type definitions containing the current type.</param>
26+ internal sealed partial record HierarchyInfo ( string FilenameHint , string MetadataName , string Namespace , ImmutableArray < TypeInfo > Hierarchy )
2727{
2828 /// <summary>
2929 /// Creates a new <see cref="HierarchyInfo"/> instance from a given <see cref="INamedTypeSymbol"/>.
@@ -32,20 +32,22 @@ internal sealed partial record HierarchyInfo(string FilenameHint, string Metadat
3232 /// <returns>A <see cref="HierarchyInfo"/> instance describing <paramref name="typeSymbol"/>.</returns>
3333 public static HierarchyInfo From ( INamedTypeSymbol typeSymbol )
3434 {
35- ImmutableArray < string > . Builder names = ImmutableArray . CreateBuilder < string > ( ) ;
35+ ImmutableArray < TypeInfo > . Builder hierarchy = ImmutableArray . CreateBuilder < TypeInfo > ( ) ;
3636
3737 for ( INamedTypeSymbol ? parent = typeSymbol ;
3838 parent is not null ;
3939 parent = parent . ContainingType )
4040 {
41- names . Add ( parent . ToDisplayString ( SymbolDisplayFormat . MinimallyQualifiedFormat ) ) ;
41+ hierarchy . Add ( new TypeInfo (
42+ parent . ToDisplayString ( SymbolDisplayFormat . MinimallyQualifiedFormat ) ,
43+ parent . TypeKind ) ) ;
4244 }
4345
4446 return new (
4547 typeSymbol . GetFullMetadataNameForFileName ( ) ,
4648 typeSymbol . MetadataName ,
4749 typeSymbol . ContainingNamespace . ToDisplayString ( new ( typeQualificationStyle : NameAndContainingTypesAndNamespaces ) ) ,
48- names . ToImmutable ( ) ) ;
50+ hierarchy . ToImmutable ( ) ) ;
4951 }
5052
5153 /// <summary>
@@ -59,7 +61,7 @@ protected override void AddToHashCode(ref HashCode hashCode, HierarchyInfo obj)
5961 hashCode . Add ( obj . FilenameHint ) ;
6062 hashCode . Add ( obj . MetadataName ) ;
6163 hashCode . Add ( obj . Namespace ) ;
62- hashCode . AddRange ( obj . Names ) ;
64+ hashCode . AddRange ( obj . Hierarchy ) ;
6365 }
6466
6567 /// <inheritdoc/>
@@ -69,7 +71,7 @@ protected override bool AreEqual(HierarchyInfo x, HierarchyInfo y)
6971 x . FilenameHint == y . FilenameHint &&
7072 x . MetadataName == y . MetadataName &&
7173 x . Namespace == y . Namespace &&
72- x . Names . SequenceEqual ( y . Names ) ;
74+ x . Hierarchy . SequenceEqual ( y . Hierarchy ) ;
7375 }
7476 }
7577}
0 commit comments