This commit is contained in:
nub31
2025-06-12 23:04:47 +02:00
parent 5a7164bd33
commit 32a341508c
4 changed files with 69 additions and 14 deletions

View File

@@ -74,13 +74,13 @@ public struct SourceText : IEquatable<SourceText>
{
private int _lines = -1;
public SourceText(string name, string content)
public SourceText(string path, string content)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Path = path ?? throw new ArgumentNullException(nameof(path));
Content = content ?? throw new ArgumentNullException(nameof(content));
}
public string Name { get; }
public string Path { get; }
public string Content { get; }
public int LineCount()
@@ -109,7 +109,7 @@ public struct SourceText : IEquatable<SourceText>
public bool Equals(SourceText other)
{
return Name == other.Name && Content == other.Content;
return Path == other.Path && Content == other.Content;
}
public override bool Equals([NotNullWhen(true)] object? obj)
@@ -119,12 +119,12 @@ public struct SourceText : IEquatable<SourceText>
public override int GetHashCode()
{
return HashCode.Combine(Name, Content);
return HashCode.Combine(Path, Content);
}
public override string ToString()
{
return Name;
return Path;
}
public static bool operator ==(SourceText left, SourceText right) => left.Equals(right);