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

Side by Side Diff: lib/src/location.dart

Issue 1028813002: Introduce span with line context (Closed) Base URL: git@github.com:dart-lang/source_span.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library source_span.location; 5 library source_span.location;
6 6
7 import 'span.dart'; 7 import 'span.dart';
8 8
9 // A class that describes a single location within a source file. 9 // A class that describes a single location within a source file.
10 class SourceLocation implements Comparable<SourceLocation> { 10 class SourceLocation implements Comparable<SourceLocation> {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /// 70 ///
71 /// [other] must have the same source URL as [this]. 71 /// [other] must have the same source URL as [this].
72 int compareTo(SourceLocation other) { 72 int compareTo(SourceLocation other) {
73 if (sourceUrl != other.sourceUrl) { 73 if (sourceUrl != other.sourceUrl) {
74 throw new ArgumentError("Source URLs \"${sourceUrl}\" and " 74 throw new ArgumentError("Source URLs \"${sourceUrl}\" and "
75 "\"${other.sourceUrl}\" don't match."); 75 "\"${other.sourceUrl}\" don't match.");
76 } 76 }
77 return offset - other.offset; 77 return offset - other.offset;
78 } 78 }
79 79
80 bool operator ==(other) => 80 bool operator ==(other) => other is SourceLocation &&
81 other is SourceLocation && sourceUrl == other.sourceUrl && 81 sourceUrl == other.sourceUrl &&
82 offset == other.offset; 82 offset == other.offset;
83 83
84 int get hashCode => sourceUrl.hashCode + offset; 84 int get hashCode => sourceUrl.hashCode + offset;
85 85
86 String toString() => '<$runtimeType: $offset $toolString>'; 86 String toString() => '<$runtimeType: $offset $toolString>';
87 } 87 }
OLDNEW
« no previous file with comments | « lib/src/file.dart ('k') | lib/src/span.dart » ('j') | lib/src/span.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698