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); |
} |