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

Side by Side Diff: pkg/barback/lib/src/span_wrapper.dart

Issue 430973002: Only support the new source_span spans in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/barback/lib/src/log.dart ('k') | pkg/barback/lib/src/transformer/transform_logger.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library source_maps.span_wrapper;
6
7 import 'package:source_maps/source_maps.dart';
8 import 'package:source_span/source_span.dart' as source_span;
9
10 /// A wrapper that exposes a [source_span.SourceSpan] as a [Span].
11 class SpanWrapper extends Span {
12 final source_span.SourceSpan _inner;
13
14 String get text => _inner.text;
15
16 SpanWrapper(source_span.SourceSpan inner, bool isIdentifier)
17 : _inner = inner,
18 super(
19 new LocationWrapper(inner.start),
20 new LocationWrapper(inner.end),
21 isIdentifier);
22
23 static Span wrap(span, [bool isIdentifier = false]) {
24 if (span is Span) return span;
25 return new SpanWrapper(span, isIdentifier);
26 }
27 }
28
29 /// A wrapper that exposes a [source_span.SourceLocation] as a [Location].
30 class LocationWrapper extends Location {
31 final source_span.SourceLocation _inner;
32
33 String get sourceUrl => _inner.sourceUrl.toString();
34 int get line => _inner.line;
35 int get column => _inner.column;
36
37 LocationWrapper(source_span.SourceLocation inner)
38 : _inner = inner,
39 super(inner.offset);
40
41 static Location wrap(location) {
42 if (location is Location) return location;
43 return new LocationWrapper(location);
44 }
45 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/log.dart ('k') | pkg/barback/lib/src/transformer/transform_logger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698