2using System.Collections.Immutable;
15 internal readonly
struct ModuleExports : IComparable<ModuleExports>
18 readonly ModuleExportsFlag _modifiers;
19 readonly
string _source;
20 readonly ImmutableHashSet<string> _targets;
28 public ModuleExports(ModuleExportsFlag modifiers,
string source, ImmutableHashSet<string> targets)
30 _modifiers = modifiers;
31 _source = source ??
throw new ArgumentNullException(nameof(source));
32 _targets = targets ??
throw new ArgumentNullException(nameof(targets));
38 public readonly ModuleExportsFlag Modifiers => _modifiers;
43 public readonly
string Source => _source;
49 public readonly ImmutableHashSet<string> Targets => _targets;
54 public readonly
bool IsQualified => _targets.IsEmpty ==
false;
57 public readonly
int CompareTo(ModuleExports other)
59 int c = _source.CompareTo(other._source);
64 c = _modifiers.CompareTo(other.Modifiers);
69 var t1 = _targets.ToArray();
70 var t2 = other._targets.ToArray();
77 public override bool Equals(
object? obj)
79 return obj is ModuleExports other && Equals(other);
83 public bool Equals(ModuleExports other)
85 return _modifiers == other._modifiers && _source == other._source && _targets.SetEquals(other._targets);
89 public override int GetHashCode()
91 var hc =
new HashCode();
95 foreach (var t
in _targets)
98 return hc.ToHashCode();
Implements an IComparer<T> which lexicographically compares a two lists.
override int Compare(TList? x, TList? y)
static new readonly LexicographicListComparer< T > Default
Returns a default LexicographicListComparer<T> instance.