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

Side by Side Diff: lib/src/span_exception.dart

Issue 1722603005: Make SourceSpanException.source a getter (Closed) Base URL: https://github.com/dart-lang/source_span.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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 import 'span.dart'; 5 import 'span.dart';
6 6
7 /// A class for exceptions that have source span information attached. 7 /// A class for exceptions that have source span information attached.
8 class SourceSpanException implements Exception { 8 class SourceSpanException implements Exception {
9 /// A message describing the exception. 9 /// A message describing the exception.
10 final String message; 10 final String message;
(...skipping 14 matching lines...) Expand all
25 /// it indicates that the text shouldn't be highlighted. 25 /// it indicates that the text shouldn't be highlighted.
26 String toString({color}) { 26 String toString({color}) {
27 if (span == null) return message; 27 if (span == null) return message;
28 return "Error on " + span.message(message, color: color); 28 return "Error on " + span.message(message, color: color);
29 } 29 }
30 } 30 }
31 31
32 /// A [SourceSpanException] that's also a [FormatException]. 32 /// A [SourceSpanException] that's also a [FormatException].
33 class SourceSpanFormatException extends SourceSpanException 33 class SourceSpanFormatException extends SourceSpanException
34 implements FormatException { 34 implements FormatException {
35 final source; 35 final _source;
36
37 // Subclasses may narrow the type.
38 dynamic get source => _source;
36 39
37 int get offset => span == null ? null : span.start.offset; 40 int get offset => span == null ? null : span.start.offset;
38 41
39 SourceSpanFormatException(String message, SourceSpan span, [this.source]) 42 SourceSpanFormatException(String message, SourceSpan span, [this._source])
40 : super(message, span); 43 : super(message, span);
41 } 44 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698