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

Unified Diff: pkg/source_span/lib/src/span_mixin.dart

Issue 754463002: Avoid instantiating FileLocations where possible in source_span. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 1 month 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 | « pkg/source_span/lib/src/file.dart ('k') | pkg/source_span/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/source_span/lib/src/span_mixin.dart
diff --git a/pkg/source_span/lib/src/span_mixin.dart b/pkg/source_span/lib/src/span_mixin.dart
index 95a720aaef3a565ddaa22b31e463f87bdcaca2a4..716e6e07b1f4638c7ecce38a383e5546691f6717 100644
--- a/pkg/source_span/lib/src/span_mixin.dart
+++ b/pkg/source_span/lib/src/span_mixin.dart
@@ -21,8 +21,8 @@ abstract class SourceSpanMixin implements SourceSpan {
int get length => end.offset - start.offset;
int compareTo(SourceSpan other) {
- int d = start.compareTo(other.start);
- return d == 0 ? end.compareTo(other.end) : d;
+ var result = start.compareTo(other.start);
+ return result == 0 ? end.compareTo(other.end) : result;
}
SourceSpan union(SourceSpan other) {
@@ -65,7 +65,7 @@ abstract class SourceSpanMixin implements SourceSpan {
return buffer.toString();
}
- bool operator ==(SourceSpan other) =>
+ bool operator ==(other) => other is SourceSpan &&
start == other.start && end == other.end;
int get hashCode => start.hashCode + (31 * end.hashCode);
« no previous file with comments | « pkg/source_span/lib/src/file.dart ('k') | pkg/source_span/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698