| 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.util; | 5 library dart2js.util; |
| 6 | 6 |
| 7 import "dart:collection"; | 7 import "dart:collection"; |
| 8 import 'util_implementation.dart'; | 8 import 'util_implementation.dart'; |
| 9 import 'characters.dart'; | 9 import 'characters.dart'; |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 abstract class Spannable {} | 22 abstract class Spannable {} |
| 23 | 23 |
| 24 class _SpannableSentinel implements Spannable { | 24 class _SpannableSentinel implements Spannable { |
| 25 final String name; | 25 final String name; |
| 26 | 26 |
| 27 const _SpannableSentinel(this.name); | 27 const _SpannableSentinel(this.name); |
| 28 | 28 |
| 29 String toString() => name; | 29 String toString() => name; |
| 30 } | 30 } |
| 31 | 31 |
| 32 /// Sentinel spannable used to mark that diagnostics should point to the |
| 33 /// current element. Note that the diagnostic reporting will fail if the current |
| 34 /// element is `null`. |
| 32 const Spannable CURRENT_ELEMENT_SPANNABLE = | 35 const Spannable CURRENT_ELEMENT_SPANNABLE = |
| 33 const _SpannableSentinel("Current element"); | 36 const _SpannableSentinel("Current element"); |
| 34 | 37 |
| 38 /// Sentinel spannable used to mark that there might be no location for the |
| 39 /// diagnostic. Use this only when it is not an error not to have a current |
| 40 /// element. |
| 41 const Spannable NO_LOCATION_SPANNABLE = |
| 42 const _SpannableSentinel("No location"); |
| 43 |
| 35 class SpannableAssertionFailure { | 44 class SpannableAssertionFailure { |
| 36 final Spannable node; | 45 final Spannable node; |
| 37 final String message; | 46 final String message; |
| 38 SpannableAssertionFailure(this.node, this.message); | 47 SpannableAssertionFailure(this.node, this.message); |
| 39 | 48 |
| 40 String toString() => 'Assertion failure' | 49 String toString() => 'Assertion failure' |
| 41 '${message != null ? ': $message' : ''}'; | 50 '${message != null ? ': $message' : ''}'; |
| 42 } | 51 } |
| 43 | 52 |
| 44 /** | 53 /** |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 buffer.write(string); | 299 buffer.write(string); |
| 291 } | 300 } |
| 292 | 301 |
| 293 int computeHashCode(part1, [part2, part3, part4, part5]) { | 302 int computeHashCode(part1, [part2, part3, part4, part5]) { |
| 294 return (part1.hashCode | 303 return (part1.hashCode |
| 295 ^ part2.hashCode | 304 ^ part2.hashCode |
| 296 ^ part3.hashCode | 305 ^ part3.hashCode |
| 297 ^ part4.hashCode | 306 ^ part4.hashCode |
| 298 ^ part5.hashCode) & 0x3fffffff; | 307 ^ part5.hashCode) & 0x3fffffff; |
| 299 } | 308 } |
| OLD | NEW |