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

Side by Side Diff: packages/source_maps/lib/src/source_map_span.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 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
« no previous file with comments | « packages/source_maps/lib/parser.dart ('k') | packages/source_maps/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library source_maps.source_map_span; 5 library source_maps.source_map_span;
6 6
7 import 'package:source_span/source_span.dart'; 7 import 'package:source_span/source_span.dart';
8 8
9 /// A [SourceSpan] for spans coming from or being written to source maps. 9 /// A [SourceSpan] for spans coming from or being written to source maps.
10 /// 10 ///
11 /// These spans have an extra piece of metadata: whether or not they represent 11 /// These spans have an extra piece of metadata: whether or not they represent
12 /// an identifier (see [isIdentifier]). 12 /// an identifier (see [isIdentifier]).
13 class SourceMapSpan extends SourceSpanBase { 13 class SourceMapSpan extends SourceSpanBase {
14 /// Whether this span represents an identifier. 14 /// Whether this span represents an identifier.
15 /// 15 ///
16 /// If this is `true`, [text] is the value of the identifier. 16 /// If this is `true`, [text] is the value of the identifier.
17 final bool isIdentifier; 17 final bool isIdentifier;
18 18
19 SourceMapSpan(SourceLocation start, SourceLocation end, String text, 19 SourceMapSpan(SourceLocation start, SourceLocation end, String text,
20 {this.isIdentifier: false}) 20 {this.isIdentifier: false})
21 : super(start, end, text); 21 : super(start, end, text);
22 22
23 /// Creates a [SourceMapSpan] for an identifier with value [text] starting at 23 /// Creates a [SourceMapSpan] for an identifier with value [text] starting at
24 /// [start]. 24 /// [start].
25 /// 25 ///
26 /// The [end] location is determined by adding [text] to [start]. 26 /// The [end] location is determined by adding [text] to [start].
27 SourceMapSpan.identifier(SourceLocation start, String text) 27 SourceMapSpan.identifier(SourceLocation start, String text)
28 : this( 28 : this(
29 start, 29 start,
30 new SourceLocation(start.offset + text.length, 30 new SourceLocation(start.offset + text.length,
31 sourceUrl: start.sourceUrl, 31 sourceUrl: start.sourceUrl,
32 line: start.line, 32 line: start.line,
33 column: start.column + text.length), 33 column: start.column + text.length),
34 text, 34 text,
35 isIdentifier: true); 35 isIdentifier: true);
36 } 36 }
37 37
38 /// A wrapper aruond a [FileSpan] that implements [SourceMapSpan]. 38 /// A wrapper aruond a [FileSpan] that implements [SourceMapSpan].
39 class SourceMapFileSpan implements SourceMapSpan, FileSpan { 39 class SourceMapFileSpan implements SourceMapSpan, FileSpan {
40 final FileSpan _inner; 40 final FileSpan _inner;
41 final bool isIdentifier; 41 final bool isIdentifier;
42 42
43 SourceFile get file => _inner.file; 43 SourceFile get file => _inner.file;
44 FileLocation get start => _inner.start; 44 FileLocation get start => _inner.start;
45 FileLocation get end => _inner.end; 45 FileLocation get end => _inner.end;
46 String get text => _inner.text; 46 String get text => _inner.text;
47 String get context => _inner.context; 47 String get context => _inner.context;
48 Uri get sourceUrl => _inner.sourceUrl; 48 Uri get sourceUrl => _inner.sourceUrl;
49 int get length => _inner.length; 49 int get length => _inner.length;
50 50
51 SourceMapFileSpan(this._inner, {this.isIdentifier: false}); 51 SourceMapFileSpan(this._inner, {this.isIdentifier: false});
52 52
53 int compareTo(SourceSpan other) => _inner.compareTo(other); 53 int compareTo(SourceSpan other) => _inner.compareTo(other);
54 String highlight({color}) => _inner.highlight(color: color);
54 SourceSpan union(SourceSpan other) => _inner.union(other); 55 SourceSpan union(SourceSpan other) => _inner.union(other);
55 FileSpan expand(FileSpan other) => _inner.expand(other); 56 FileSpan expand(FileSpan other) => _inner.expand(other);
56 String message(String message, {color}) => 57 String message(String message, {color}) =>
57 _inner.message(message, color: color); 58 _inner.message(message, color: color);
58 String toString() => _inner.toString() 59 String toString() =>
59 .replaceAll("FileSpan", "SourceMapFileSpan"); 60 _inner.toString().replaceAll("FileSpan", "SourceMapFileSpan");
60 } 61 }
OLDNEW
« no previous file with comments | « packages/source_maps/lib/parser.dart ('k') | packages/source_maps/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698