@@ -22,8 +22,8 @@ namespace CommunityToolkit.Mvvm.SourceGenerators.Models;
22
22
/// <param name="FilenameHint">The filename hint for the current type.</param>
23
23
/// <param name="MetadataName">The metadata name for the current type.</param>
24
24
/// <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 )
27
27
{
28
28
/// <summary>
29
29
/// 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
32
32
/// <returns>A <see cref="HierarchyInfo"/> instance describing <paramref name="typeSymbol"/>.</returns>
33
33
public static HierarchyInfo From ( INamedTypeSymbol typeSymbol )
34
34
{
35
- ImmutableArray < string > . Builder names = ImmutableArray . CreateBuilder < string > ( ) ;
35
+ ImmutableArray < TypeInfo > . Builder hierarchy = ImmutableArray . CreateBuilder < TypeInfo > ( ) ;
36
36
37
37
for ( INamedTypeSymbol ? parent = typeSymbol ;
38
38
parent is not null ;
39
39
parent = parent . ContainingType )
40
40
{
41
- names . Add ( parent . ToDisplayString ( SymbolDisplayFormat . MinimallyQualifiedFormat ) ) ;
41
+ hierarchy . Add ( new TypeInfo (
42
+ parent . ToDisplayString ( SymbolDisplayFormat . MinimallyQualifiedFormat ) ,
43
+ parent . TypeKind ) ) ;
42
44
}
43
45
44
46
return new (
45
47
typeSymbol . GetFullMetadataNameForFileName ( ) ,
46
48
typeSymbol . MetadataName ,
47
49
typeSymbol . ContainingNamespace . ToDisplayString ( new ( typeQualificationStyle : NameAndContainingTypesAndNamespaces ) ) ,
48
- names . ToImmutable ( ) ) ;
50
+ hierarchy . ToImmutable ( ) ) ;
49
51
}
50
52
51
53
/// <summary>
@@ -59,7 +61,7 @@ protected override void AddToHashCode(ref HashCode hashCode, HierarchyInfo obj)
59
61
hashCode . Add ( obj . FilenameHint ) ;
60
62
hashCode . Add ( obj . MetadataName ) ;
61
63
hashCode . Add ( obj . Namespace ) ;
62
- hashCode . AddRange ( obj . Names ) ;
64
+ hashCode . AddRange ( obj . Hierarchy ) ;
63
65
}
64
66
65
67
/// <inheritdoc/>
@@ -69,7 +71,7 @@ protected override bool AreEqual(HierarchyInfo x, HierarchyInfo y)
69
71
x . FilenameHint == y . FilenameHint &&
70
72
x . MetadataName == y . MetadataName &&
71
73
x . Namespace == y . Namespace &&
72
- x . Names . SequenceEqual ( y . Names ) ;
74
+ x . Hierarchy . SequenceEqual ( y . Hierarchy ) ;
73
75
}
74
76
}
75
77
}
0 commit comments