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

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

Issue 1315423002: pkg/source_span: Eliminate dart2js warning about overriding `==`, but not `hashCode`. (Closed) Base URL: https://github.com/dart-lang/source_span.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.file; 5 library source_span.file;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 import 'dart:typed_data'; 8 import 'dart:typed_data';
9 9
10 import 'location.dart'; 10 import 'location.dart';
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool operator ==(other) { 256 bool operator ==(other) {
257 if (other is! FileSpan) return super == other; 257 if (other is! FileSpan) return super == other;
258 if (other is! _FileSpan) { 258 if (other is! _FileSpan) {
259 return super == other && sourceUrl == other.sourceUrl; 259 return super == other && sourceUrl == other.sourceUrl;
260 } 260 }
261 261
262 return _start == other._start && _end == other._end && 262 return _start == other._start && _end == other._end &&
263 sourceUrl == other.sourceUrl; 263 sourceUrl == other.sourceUrl;
264 } 264 }
265 265
266 // Eliminates dart2js warning about overriding `==`, but not `hashCode`
267 int get hashCode => super.hashCode;
268
266 /// Returns a new span that covers both [this] and [other]. 269 /// Returns a new span that covers both [this] and [other].
267 /// 270 ///
268 /// Unlike [union], [other] may be disjoint from [this]. If it is, the text 271 /// Unlike [union], [other] may be disjoint from [this]. If it is, the text
269 /// between the two will be covered by the returned span. 272 /// between the two will be covered by the returned span.
270 FileSpan expand(FileSpan other) { 273 FileSpan expand(FileSpan other) {
271 if (sourceUrl != other.sourceUrl) { 274 if (sourceUrl != other.sourceUrl) {
272 throw new ArgumentError("Source URLs \"${sourceUrl}\" and " 275 throw new ArgumentError("Source URLs \"${sourceUrl}\" and "
273 " \"${other.sourceUrl}\" don't match."); 276 " \"${other.sourceUrl}\" don't match.");
274 } 277 }
275 278
276 if (other is _FileSpan) { 279 if (other is _FileSpan) {
277 var start = math.min(this._start, other._start); 280 var start = math.min(this._start, other._start);
278 var end = math.max(this._end, other._end); 281 var end = math.max(this._end, other._end);
279 return new _FileSpan(file, start, end); 282 return new _FileSpan(file, start, end);
280 } else { 283 } else {
281 var start = math.min(this._start, other.start.offset); 284 var start = math.min(this._start, other.start.offset);
282 var end = math.max(this._end, other.end.offset); 285 var end = math.max(this._end, other.end.offset);
283 return new _FileSpan(file, start, end); 286 return new _FileSpan(file, start, end);
284 } 287 }
285 } 288 }
286 } 289 }
OLDNEW
« 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