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

Unified Diff: source_span/lib/src/location_mixin.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « source_span/lib/src/location.dart ('k') | source_span/lib/src/span.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source_span/lib/src/location_mixin.dart
diff --git a/source_span/lib/src/location_mixin.dart b/source_span/lib/src/location_mixin.dart
deleted file mode 100644
index 5aa0de5ce5e97cb16696677de44ca71f30573981..0000000000000000000000000000000000000000
--- a/source_span/lib/src/location_mixin.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library source_span.location_mixin;
-
-import 'location.dart';
-import 'span.dart';
-
-// Note: this class duplicates a lot of functionality of [SourceLocation]. This
-// is because in order for SourceLocation to use SourceLocationMixin,
-// SourceLocationMixin couldn't implement SourceLocation. In SourceSpan we
-// handle this by making the class itself non-extensible, but that would be a
-// breaking change for SourceLocation. So until we want to endure the pain of
-// cutting a release with breaking changes, we duplicate the code here.
-
-/// A mixin for easily implementing [SourceLocation].
-abstract class SourceLocationMixin implements SourceLocation {
- String get toolString {
- var source = sourceUrl == null ? 'unknown source' : sourceUrl;
- return '$source:${line + 1}:${column + 1}';
- }
-
- int distance(SourceLocation other) {
- if (sourceUrl != other.sourceUrl) {
- throw new ArgumentError("Source URLs \"${sourceUrl}\" and "
- "\"${other.sourceUrl}\" don't match.");
- }
- return (offset - other.offset).abs();
- }
-
- SourceSpan pointSpan() => new SourceSpan(this, this, "");
-
- int compareTo(SourceLocation other) {
- if (sourceUrl != other.sourceUrl) {
- throw new ArgumentError("Source URLs \"${sourceUrl}\" and "
- "\"${other.sourceUrl}\" don't match.");
- }
- return offset - other.offset;
- }
-
- bool operator ==(other) =>
- other is SourceLocation &&
- sourceUrl == other.sourceUrl &&
- offset == other.offset;
-
- int get hashCode => sourceUrl.hashCode + offset;
-
- String toString() => '<$runtimeType: $offset $toolString>';
-}
-
« no previous file with comments | « source_span/lib/src/location.dart ('k') | source_span/lib/src/span.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698