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

Unified Diff: pkg/source_maps/lib/span.dart

Issue 20600002: Fix source spans hashcode implementation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « no previous file | pkg/source_maps/test/span_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/source_maps/lib/span.dart
diff --git a/pkg/source_maps/lib/span.dart b/pkg/source_maps/lib/span.dart
index 1d2152da70c4e59c7ff0a1b58d9dcac0f8c28af6..e5057fcebd717785f9c1330b877d9045c1250d61 100644
--- a/pkg/source_maps/lib/span.dart
+++ b/pkg/source_maps/lib/span.dart
@@ -69,7 +69,7 @@ abstract class Span implements Comparable {
bool operator ==(Span other) =>
sourceUrl == other.sourceUrl && start == other.start && end == other.end;
- int get hashCode => sourceUrl.hashCode + start + (31 * (end - start));
+ int get hashCode => sourceUrl.hashCode + start.offset + (31 * length);
justinfagnani 2013/07/26 00:44:22 length includes information from start.offset alre
Siggi Cherem (dart-lang) 2013/07/26 00:50:12 I could argue the opposite: end.offset is always >
String toString() => '<$runtimeType: $start $end $formatLocation $text>';
}
@@ -99,6 +99,11 @@ abstract class Location implements Comparable {
return offset - other.offset;
}
+ bool operator ==(Location other) =>
+ sourceUrl == other.sourceUrl && offset == other.offset;
+
+ int get hashCode => sourceUrl.hashCode + offset;
+
String toString() => '(Location $offset)';
String get formatString => '$sourceUrl:${line + 1}:${column + 1}';
}
« no previous file with comments | « no previous file | pkg/source_maps/test/span_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698