Switch to EquatableArray<T> in shared models
このコミットが含まれているのは:
1 親
03051082d5
コミット
306cf615ce
4ファイル変更
+12
-123
検索条件に一致するファイルはありません
@@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using ComputeSharp.SourceGeneration.Extensions;
|
||||
using ComputeSharp.SourceGeneration.Helpers;
|
||||
using Microsoft.CodeAnalysis;
|
||||
@@ -18,7 +15,7 @@ namespace ComputeSharp.SourceGeneration.Models;
|
||||
/// <param name="FullyQualifiedMetadataName">The fully qualified metadata name for the current type.</param>
|
||||
/// <param name="Namespace">Gets the namespace for the current type.</param>
|
||||
/// <param name="Hierarchy">Gets the sequence of type definitions containing the current type.</param>
|
||||
internal sealed partial record HierarchyInfo(string FilenameHint, string FullyQualifiedMetadataName, string Namespace, ImmutableArray<TypeInfo> Hierarchy)
|
||||
internal sealed partial record HierarchyInfo(string FilenameHint, string FullyQualifiedMetadataName, string Namespace, EquatableArray<TypeInfo> Hierarchy)
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="HierarchyInfo"/> instance from a given <see cref="INamedTypeSymbol"/>.
|
||||
@@ -110,41 +107,4 @@ internal sealed partial record HierarchyInfo(string FilenameHint, string FullyQu
|
||||
.AddMembers(typeDeclarationSyntax))
|
||||
.NormalizeWhitespace(eol: "\n");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(HierarchyInfo? obj)
|
||||
{
|
||||
return Comparer.Default.Equals(this, obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Comparer.Default.GetHashCode(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IEqualityComparer{T}"/> implementation for <see cref="HierarchyInfo"/>.
|
||||
/// </summary>
|
||||
private sealed class Comparer : Comparer<HierarchyInfo, Comparer>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
protected override void AddToHashCode(ref HashCode hashCode, HierarchyInfo obj)
|
||||
{
|
||||
hashCode.Add(obj.FilenameHint);
|
||||
hashCode.Add(obj.FullyQualifiedMetadataName);
|
||||
hashCode.Add(obj.Namespace);
|
||||
hashCode.AddRange(obj.Hierarchy);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool AreEqual(HierarchyInfo x, HierarchyInfo y)
|
||||
{
|
||||
return
|
||||
x.FilenameHint == y.FilenameHint &&
|
||||
x.FullyQualifiedMetadataName == y.FullyQualifiedMetadataName &&
|
||||
x.Namespace == y.Namespace &&
|
||||
x.Hierarchy.SequenceEqual(y.Hierarchy);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする