| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 dart2js.diagnostics.spannable; | 5 library dart2js.diagnostics.spannable; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Tagging interface for classes from which source spans can be generated. | 8 * Tagging interface for classes from which source spans can be generated. |
| 9 */ | 9 */ |
| 10 // TODO(johnniwinther): Find a better name. | 10 // TODO(johnniwinther): Find a better name. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 /// Sentinel spannable used to mark that diagnostics should point to the | 22 /// Sentinel spannable used to mark that diagnostics should point to the |
| 23 /// current element. Note that the diagnostic reporting will fail if the current | 23 /// current element. Note that the diagnostic reporting will fail if the current |
| 24 /// element is `null`. | 24 /// element is `null`. |
| 25 const Spannable CURRENT_ELEMENT_SPANNABLE = | 25 const Spannable CURRENT_ELEMENT_SPANNABLE = |
| 26 const _SpannableSentinel("Current element"); | 26 const _SpannableSentinel("Current element"); |
| 27 | 27 |
| 28 /// Sentinel spannable used to mark that there might be no location for the | 28 /// Sentinel spannable used to mark that there might be no location for the |
| 29 /// diagnostic. Use this only when it is not an error not to have a current | 29 /// diagnostic. Use this only when it is not an error not to have a current |
| 30 /// element. | 30 /// element. |
| 31 const Spannable NO_LOCATION_SPANNABLE = | 31 const Spannable NO_LOCATION_SPANNABLE = const _SpannableSentinel("No location"); |
| 32 const _SpannableSentinel("No location"); | |
| 33 | 32 |
| 34 class SpannableAssertionFailure { | 33 class SpannableAssertionFailure { |
| 35 final Spannable node; | 34 final Spannable node; |
| 36 final String message; | 35 final String message; |
| 37 SpannableAssertionFailure(this.node, this.message); | 36 SpannableAssertionFailure(this.node, this.message); |
| 38 | 37 |
| 39 String toString() => 'Assertion failure' | 38 String toString() => 'Assertion failure' |
| 40 '${message != null ? ': $message' : ''}'; | 39 '${message != null ? ': $message' : ''}'; |
| 41 } | 40 } |
| OLD | NEW |