Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Unified Diff: lib/src/location.dart

Issue 881673002: Cleanup equality operator to accept any Object rather than just a SourceLocation. (Closed) Base URL: git@github.com:dart-lang/source_span.git@master
Patch Set: PTAL Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/location.dart
diff --git a/lib/src/location.dart b/lib/src/location.dart
index 41f251898c69e840aaf38199ddaf74363b3e16d2..27057424b1f3cf4ada9b14142654aabc24251c80 100644
--- a/lib/src/location.dart
+++ b/lib/src/location.dart
@@ -77,8 +77,9 @@ class SourceLocation implements Comparable<SourceLocation> {
return offset - other.offset;
}
- bool operator ==(SourceLocation other) =>
- sourceUrl == other.sourceUrl && offset == other.offset;
+ bool operator ==(other) =>
+ other is SourceLocation && sourceUrl == other.sourceUrl &&
+ offset == other.offset;
int get hashCode => sourceUrl.hashCode + offset;
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698