namespace Semmle.Extraction.PDB { /// /// A location in source code. /// public sealed class Location { /// /// The file containing the code. /// public ISourceFile File { get; } /// /// The start line of text within the source file. /// public int StartLine { get; } /// /// The start column of text within the source file. /// public int StartColumn { get; } /// /// The end line of text within the source file. /// public int EndLine { get; } /// /// The end column of text within the source file. /// public int EndColumn { get; } public override string ToString() { return string.Format("({0},{1})-({2},{3})", StartLine, StartColumn, EndLine, EndColumn); } public override bool Equals(object? obj) { return obj is Location otherLocation && File.Equals(otherLocation.File) && StartLine == otherLocation.StartLine && StartColumn == otherLocation.StartColumn && EndLine == otherLocation.EndLine && EndColumn == otherLocation.EndColumn; } public override int GetHashCode() { var h1 = StartLine + 37 * (StartColumn + 51 * (EndLine + 97 * EndColumn)); return File.GetHashCode() + 17 * h1; } public Location(ISourceFile file, int startLine, int startCol, int endLine, int endCol) { File = file; StartLine = startLine; StartColumn = startCol; EndLine = endLine; EndColumn = endCol; } } }