Revert "Include LineIndex and CharacterIndex when comparing SourceLocation"
This reverts commit 0e20ea5178.
This commit is contained in:
parent
0e20ea5178
commit
bace4a3818
|
|
@ -116,10 +116,9 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
/// <inheritdoc />
|
||||
public bool Equals(SourceLocation other)
|
||||
{
|
||||
// LineIndex and CharacterIndex can be calculated from AbsoluteIndex and the document content.
|
||||
return string.Equals(FilePath, other.FilePath, StringComparison.Ordinal) &&
|
||||
AbsoluteIndex == other.AbsoluteIndex &&
|
||||
LineIndex == other.LineIndex &&
|
||||
CharacterIndex == other.CharacterIndex;
|
||||
AbsoluteIndex == other.AbsoluteIndex;
|
||||
}
|
||||
|
||||
public static bool operator==(SourceLocation left, SourceLocation right)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
|
|||
var suffixLocation1 = new SourceLocation(
|
||||
absoluteIndex: 8 + newlineLength + attributeNameLength,
|
||||
lineIndex: 1,
|
||||
characterIndex: 5);
|
||||
characterIndex: 5 + attributeNameLength);
|
||||
var valueLocation1 = new SourceLocation(
|
||||
absoluteIndex: 5 + attributeNameLength + newlineLength,
|
||||
lineIndex: 1,
|
||||
characterIndex: 2);
|
||||
characterIndex: 2 + attributeNameLength);
|
||||
var prefixLocation2 = SourceLocationTracker.Advance(suffixLocation1, "'");
|
||||
var suffixLocation2 = new SourceLocation(
|
||||
absoluteIndex: 15 + attributeNameLength * 2 + newlineLength * 2,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Equals_ReturnsFalse_FilePathsNullAndAbsoluteIndicesMatch()
|
||||
public void Equals_ReturnsTrue_FilePathsNullAndAbsoluteIndicesMatch()
|
||||
{
|
||||
// Arrange
|
||||
var sourceLocationA = new SourceLocation(10, 3, 4);
|
||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
var result = sourceLocationA.Equals(sourceLocationB);
|
||||
|
||||
// Assert
|
||||
Assert.False(result);
|
||||
Assert.True(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue