| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 class SpannableAssertionFailure { | 35 class SpannableAssertionFailure { |
| 36 final Spannable node; | 36 final Spannable node; |
| 37 final String message; | 37 final String message; |
| 38 SpannableAssertionFailure(this.node, this.message); | 38 SpannableAssertionFailure(this.node, this.message); |
| 39 | 39 |
| 40 String toString() => 'Assertion failure' | 40 String toString() => 'Assertion failure' |
| 41 '${message != null ? ': $message' : ''}'; | 41 '${message != null ? ': $message' : ''}'; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool equalElements(List a, List b) { |
| 45 if (a.length != b.length) return false; |
| 46 for (int index = 0; index < a.length; index++) { |
| 47 if (a[index] != b[index]) { |
| 48 return false; |
| 49 } |
| 50 } |
| 51 return true; |
| 52 } |
| 53 |
| 44 /** | 54 /** |
| 45 * Helper method for printing stack traces for debugging. | 55 * Helper method for printing stack traces for debugging. |
| 46 * | 56 * |
| 47 * [message] is printed as the header of the stack trace. | 57 * [message] is printed as the header of the stack trace. |
| 48 * | 58 * |
| 49 * If [condition] is provided, the stack trace is only printed if [condition] | 59 * If [condition] is provided, the stack trace is only printed if [condition] |
| 50 * returns [:true:] on the stack trace text. This can be used to filter the | 60 * returns [:true:] on the stack trace text. This can be used to filter the |
| 51 * printed stack traces based on their content. For instance only print stack | 61 * printed stack traces based on their content. For instance only print stack |
| 52 * traces that contain specific paths. | 62 * traces that contain specific paths. |
| 53 */ | 63 */ |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 buffer.write(string); | 300 buffer.write(string); |
| 291 } | 301 } |
| 292 | 302 |
| 293 int computeHashCode(part1, [part2, part3, part4, part5]) { | 303 int computeHashCode(part1, [part2, part3, part4, part5]) { |
| 294 return (part1.hashCode | 304 return (part1.hashCode |
| 295 ^ part2.hashCode | 305 ^ part2.hashCode |
| 296 ^ part3.hashCode | 306 ^ part3.hashCode |
| 297 ^ part4.hashCode | 307 ^ part4.hashCode |
| 298 ^ part5.hashCode) & 0x3fffffff; | 308 ^ part5.hashCode) & 0x3fffffff; |
| 299 } | 309 } |
| OLD | NEW |