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

Unified Diff: lib/src/location.dart

Issue 1307123004: Add SourceLocationMixin and SourceLocationBase. (Closed) Base URL: git@github.com:dart-lang/source_span@master
Patch Set: Code review changes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/file.dart ('k') | lib/src/location_mixin.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/location.dart
diff --git a/lib/src/location.dart b/lib/src/location.dart
index 024c6e2780a340d4eddcc2cefa3094d6c95606b8..afb37c768c97e4018075c094cea1eae25ed1adaf 100644
--- a/lib/src/location.dart
+++ b/lib/src/location.dart
@@ -6,7 +6,13 @@ library source_span.location;
import 'span.dart';
-// A class that describes a single location within a source file.
+// TODO(nweiz): Use SourceLocationMixin once we decide to cut a release with
+// breaking changes. See SourceLocationMixin for details.
+
+/// A class that describes a single location within a source file.
+///
+/// This class should not be extended. Instead, [SourceLocationBase] should be
+/// extended instead.
class SourceLocation implements Comparable<SourceLocation> {
/// URL of the source containing this location.
///
@@ -85,3 +91,10 @@ class SourceLocation implements Comparable<SourceLocation> {
String toString() => '<$runtimeType: $offset $toolString>';
}
+
+/// A base class for source locations with [offset], [line], and [column] known
+/// at construction time.
+class SourceLocationBase extends SourceLocation {
+ SourceLocationBase(int offset, {sourceUrl, int line, int column})
+ : super(offset, sourceUrl: sourceUrl, line: line, column: column);
+}
« no previous file with comments | « lib/src/file.dart ('k') | lib/src/location_mixin.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698