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

Unified Diff: pkg/yaml/lib/src/null_span.dart

Issue 401753002: Move a number of packages and some of pub over to using source_span. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 5 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 | « pkg/yaml/lib/src/model.dart ('k') | pkg/yaml/lib/src/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/yaml/lib/src/null_span.dart
diff --git a/pkg/yaml/lib/src/null_span.dart b/pkg/yaml/lib/src/null_span.dart
index b3e32549951be3259886a034f0fa3eed7f9530e2..1054df1680989d4ceb08a8da21cf51dc3e60832a 100644
--- a/pkg/yaml/lib/src/null_span.dart
+++ b/pkg/yaml/lib/src/null_span.dart
@@ -4,44 +4,18 @@
library yaml.null_span;
-import 'package:path/path.dart' as p;
-import 'package:source_maps/source_maps.dart';
+import 'package:source_span/source_span.dart';
/// A [Span] with no location information.
///
/// This is used with [YamlMap.wrap] and [YamlList.wrap] to provide means of
/// accessing a non-YAML map that behaves transparently like a map parsed from
/// YAML.
-class NullSpan extends Span {
- Location get end => start;
+class NullSpan extends SourceSpanMixin {
+ final SourceLocation start;
+ SourceLocation get end => start;
final text = "";
- NullSpan(String sourceUrl)
- : this._(new NullLocation(sourceUrl));
-
- NullSpan._(Location location)
- : super(location, location, false);
-
- String formatLocationMessage(String message, {bool useColors: false,
- String color}) {
- var locationMessage = sourceUrl == null ? "in an unknown location" :
- "in ${p.prettyUri(sourceUrl)}";
- return "$locationMessage: $message";
- }
-}
-
-/// A [Location] with no location information.
-///
-/// This is used with [YamlMap.wrap] and [YamlList.wrap] to provide means of
-/// accessing a non-YAML map that behaves transparently like a map parsed from
-/// YAML.
-class NullLocation extends Location {
- final String sourceUrl;
- final line = 0;
- final column = 0;
-
- String get formatString => sourceUrl == null ? "unknown location" : sourceUrl;
-
- NullLocation(this.sourceUrl)
- : super(0);
+ NullSpan(sourceUrl)
+ : start = new SourceLocation(0, sourceUrl: sourceUrl);
}
« no previous file with comments | « pkg/yaml/lib/src/model.dart ('k') | pkg/yaml/lib/src/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698