Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/ArrayTypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal sealed record ArrayTypeModel(
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record ArrayTypeModel(
TypeModel ElementType,
EquatableList<String> NamespaceParts,
String Name) : TypeModel(
Expand Down
14 changes: 12 additions & 2 deletions UtilityGenerators/Library/Models/AttributeParameterTypeKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal enum AttributeParameterTypeKind
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
enum AttributeParameterTypeKind
{
ReferenceType = 1,
Type = 2,
Expand Down Expand Up @@ -36,7 +41,12 @@ internal enum AttributeParameterTypeKind
NullableReferenceTypeNullableArray = Nullable | ReferenceType | NullableArray,
}

internal static class AttributeArgumentTypeKindExtensions
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
static class AttributeArgumentTypeKindExtensions
{
public static Boolean HasAnyFlagFast(this AttributeParameterTypeKind value, params ReadOnlySpan<AttributeParameterTypeKind> flags)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal sealed record AttributeParameterTypeModel(
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record AttributeParameterTypeModel(
AttributeParameterTypeKind Kind,
String KindString,
String DisplayString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal sealed partial class DictionaryEqualityComparer<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) : IEqualityComparer<IDictionary<TKey, TValue>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class DictionaryEqualityComparer<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) : IEqualityComparer<IDictionary<TKey, TValue>>
{
public DictionaryEqualityComparer(IEqualityComparer<TValue> valueComparer) : this(EqualityComparer<TKey>.Default, valueComparer) { }
public DictionaryEqualityComparer(IEqualityComparer<TKey> keyComparer) : this(keyComparer, EqualityComparer<TValue>.Default) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal static class EnumerableEqualityComparer
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
static class EnumerableEqualityComparer
{
public static Int32 GetHashCode<TEnumerable, T>(TEnumerable obj, IEqualityComparer<T> elementComparer)
where TEnumerable : IEnumerable<T>
Expand All @@ -26,7 +31,12 @@ public static Int32 GetHashCode<TEnumerable, T>(TEnumerable obj, IEqualityCompar
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[NonEquatable]
#endif
internal sealed partial class EnumerableEqualityComparer<T>(IEqualityComparer<T> elementComparer) : IEqualityComparer<IEnumerable<T>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class EnumerableEqualityComparer<T>(IEqualityComparer<T> elementComparer) : IEqualityComparer<IEnumerable<T>>
{
public static EnumerableEqualityComparer<T> Default { get; } = new(EqualityComparer<T>.Default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal partial class EqualityComparerFactory
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
partial class EqualityComparerFactory
{
public static EqualityComparerFactory Default { get; } = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
[IncludeFile]
#endif
[DebuggerDisplay("Count: {Count}")]
internal sealed record EquatableCollection<T> : EquatableCollection<T, ICollection<T>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record EquatableCollection<T> : EquatableCollection<T, ICollection<T>>
{
public EquatableCollection(
ICollection<T> collection,
Expand All @@ -21,7 +26,12 @@ public EquatableCollection(
{ }
}

internal abstract record EquatableCollection<T, TCollection> : MutableCollection, ICollection<T>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
abstract record EquatableCollection<T, TCollection> : MutableCollection, ICollection<T>
where TCollection : ICollection<T>
{
public EquatableCollection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal sealed partial class EquatableCollectionFactory(EqualityComparerFactory comparerFactory, MutabilityContext mutabilityContext) : IDisposable
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class EquatableCollectionFactory(EqualityComparerFactory comparerFactory, MutabilityContext mutabilityContext) : IDisposable
{
public static EquatableCollectionFactory CreateDefault() => new(EqualityComparerFactory.Default, new());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
[IncludeFile]
#endif
[DebuggerDisplay("Count: {Count}")]
internal sealed record EquatableDictionary<TKey, TValue> : EquatableCollection<KeyValuePair<TKey, TValue>, IDictionary<TKey, TValue>>, IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record EquatableDictionary<TKey, TValue> : EquatableCollection<KeyValuePair<TKey, TValue>, IDictionary<TKey, TValue>>, IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>
{
public EquatableDictionary(
IDictionary<TKey, TValue> collection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#endif
[CollectionBuilder(typeof(Builder), "Create")]
[DebuggerDisplay("Count: {Count}")]
internal sealed record EquatableList<T> : EquatableCollection<T, IList<T>>, IList<T>, IReadOnlyList<T>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record EquatableList<T> : EquatableCollection<T, IList<T>>, IList<T>, IReadOnlyList<T>
{
public EquatableList(
IList<T> collection,
Expand Down
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/Collections/EquatableSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#endif
[CollectionBuilder(typeof(Builder), "Create")]
[DebuggerDisplay("Count: {Count}")]
internal sealed record EquatableSet<T> : EquatableCollection<T, ISet<T>>, ISet<T>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record EquatableSet<T> : EquatableCollection<T, ISet<T>>, ISet<T>
{
public EquatableSet(
ISet<T> collection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal sealed partial class KeyValuePairEqualityComparer<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) : IEqualityComparer<KeyValuePair<TKey, TValue>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class KeyValuePairEqualityComparer<TKey, TValue>(IEqualityComparer<TKey> keyComparer, IEqualityComparer<TValue> valueComparer) : IEqualityComparer<KeyValuePair<TKey, TValue>>
{
public KeyValuePairEqualityComparer(IEqualityComparer<TValue> valueComparer) : this(EqualityComparer<TKey>.Default, valueComparer) { }
public static KeyValuePairEqualityComparer<TKey, TValue> Default { get; } = new(EqualityComparer<TKey>.Default, EqualityComparer<TValue>.Default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
[IncludeFile]
#endif
[DebuggerDisplay("Count: {Count}")]
internal sealed record LazyEquatableDictionary<TKey, TValue> : LazyEquatableDictionary<TKey, TValue, LazyEquatableDictionary<TKey, TValue>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record LazyEquatableDictionary<TKey, TValue> : LazyEquatableDictionary<TKey, TValue, LazyEquatableDictionary<TKey, TValue>>
{
public LazyEquatableDictionary(
IDictionary<TKey, TValue> collection,
Expand All @@ -24,7 +29,13 @@ public LazyEquatableDictionary(
public Boolean Equals(LazyEquatableDictionary<TKey, TValue> other) => base.Equals(other);
public override Int32 GetHashCode() => base.GetHashCode();
}
internal record LazyEquatableDictionary<TKey, TValue, TState> : EquatableCollection<KeyValuePair<TKey, TValue>, IDictionary<TKey, TValue>>, IDictionary<TKey, TValue>

#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
record LazyEquatableDictionary<TKey, TValue, TState> : EquatableCollection<KeyValuePair<TKey, TValue>, IDictionary<TKey, TValue>>, IDictionary<TKey, TValue>
{
public LazyEquatableDictionary(
IDictionary<TKey, TValue> collection,
Expand Down
15 changes: 13 additions & 2 deletions UtilityGenerators/Library/Models/Collections/LazyEquatableList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#endif
[CollectionBuilder(typeof(Builder), "Create")]
[DebuggerDisplay("Count: {Count}")]
internal sealed record LazyEquatableList<T> : LazyEquatableList<T, LazyEquatableList<T>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record LazyEquatableList<T> : LazyEquatableList<T, LazyEquatableList<T>>
{
public LazyEquatableList(
IList<T> collection,
Expand All @@ -26,7 +31,13 @@ public LazyEquatableList(
public Boolean Equals(LazyEquatableList<T> other) => base.Equals(other);
public override Int32 GetHashCode() => base.GetHashCode();
}
internal record LazyEquatableList<T, TState> : EquatableCollection<T, IList<T>>, IList<T>, IReadOnlyList<T>

#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
record LazyEquatableList<T, TState> : EquatableCollection<T, IList<T>>, IList<T>, IReadOnlyList<T>
{
public LazyEquatableList(
IList<T> collection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal sealed partial class MutabilityContext : IDisposable
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class MutabilityContext : IDisposable
{
private Int32 _mutable;
public Boolean IsImmutable => _mutable == 1;
Expand Down
14 changes: 12 additions & 2 deletions UtilityGenerators/Library/Models/Collections/MutableCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
[IncludeFile]
#endif
[DebuggerDisplay("Count: {Count}")]
internal abstract partial record MutableCollection(MutabilityContext MutabilityContext)
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
abstract partial record MutableCollection(MutabilityContext MutabilityContext)
{
public MutableCollection() : this(new MutabilityContext()) { }
public Boolean IsReadOnly => MutabilityContext.IsImmutable;
Expand All @@ -22,7 +27,12 @@ public MutableCollection() : this(new MutabilityContext()) { }
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[NonEquatable]
#endif
internal partial class MutableCollection<T>(ICollection<T> wrapped, MutabilityContext mutabilityContext) : ICollection<T>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
partial class MutableCollection<T>(ICollection<T> wrapped, MutabilityContext mutabilityContext) : ICollection<T>
{
public void Add(T item)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models.Collections;
#if GENERATOR
[NonEquatable]
#endif
internal sealed partial class SetEqualityComparer<T>(IEqualityComparer<T> elementComparer) : IEqualityComparer<ISet<T>>
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed partial class SetEqualityComparer<T>(IEqualityComparer<T> elementComparer) : IEqualityComparer<ISet<T>>
{
public static SetEqualityComparer<T> Default { get; } = new(EqualityComparer<T>.Default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal readonly record struct ContainingTypeSignatureModel(
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
readonly record struct ContainingTypeSignatureModel(
PartialTypeKindModel Kind,
String Name,
EquatableList<TypeModel> TypeArguments)
Expand Down
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/ModelCreationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if GENERATOR
[NonEquatable]
#endif
internal readonly partial struct ModelCreationContext(EquatableCollectionFactory collectionFactory, CancellationToken cancellationToken) : IDisposable
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
readonly partial struct ModelCreationContext(EquatableCollectionFactory collectionFactory, CancellationToken cancellationToken) : IDisposable
{
public EquatableCollectionFactory CollectionFactory { get; } = collectionFactory;
public CancellationToken CancellationToken { get; } = cancellationToken;
Expand Down
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/NamedTypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal sealed record NamedTypeModel(
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
sealed record NamedTypeModel(
EquatableList<ContainingTypeSignatureModel> ContainingTypes,
Accessibility? Accessibility,
PartialTypeKindModel Kind,
Expand Down
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/PartialTypeKindModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal readonly record struct PartialTypeKindModel(String Value)
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
readonly record struct PartialTypeKindModel(String Value)
{
public static PartialTypeKindModel Class => new("class");
public static PartialTypeKindModel Record => new("record");
Expand Down
7 changes: 6 additions & 1 deletion UtilityGenerators/Library/Models/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ namespace RhoMicro.CodeAnalysis.Library.Models;
#if RHOMICRO_CODEANALYSIS_UTILITYGENERATORS
[IncludeFile]
#endif
internal record TypeModel(
#if RHOMICRO_EMIT_PUBLIC_COLLECTIONS
public
#else
internal
#endif
record TypeModel(
EquatableList<String> NamespaceParts,
String Name)
{
Expand Down