| 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 'util_implementation.dart'; | 7 import 'util_implementation.dart'; |
| 8 import 'characters.dart'; | 8 import 'characters.dart'; |
| 9 | 9 |
| 10 export 'setlet.dart'; | 10 export 'setlet.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class SpannableAssertionFailure { | 41 class SpannableAssertionFailure { |
| 42 final Spannable node; | 42 final Spannable node; |
| 43 final String message; | 43 final String message; |
| 44 SpannableAssertionFailure(this.node, this.message); | 44 SpannableAssertionFailure(this.node, this.message); |
| 45 | 45 |
| 46 String toString() => 'Assertion failure' | 46 String toString() => 'Assertion failure' |
| 47 '${message != null ? ': $message' : ''}'; | 47 '${message != null ? ': $message' : ''}'; |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool equalElements(List a, List b) { |
| 51 if (a.length != b.length) return false; |
| 52 for (int index = 0; index < a.length; index++) { |
| 53 if (a[index] != b[index]) { |
| 54 return false; |
| 55 } |
| 56 } |
| 57 return true; |
| 58 } |
| 59 |
| 50 /** | 60 /** |
| 51 * File name prefix used to shorten the file name in stack traces printed by | 61 * File name prefix used to shorten the file name in stack traces printed by |
| 52 * [trace]. | 62 * [trace]. |
| 53 */ | 63 */ |
| 54 String stackTraceFilePrefix = null; | 64 String stackTraceFilePrefix = null; |
| 55 | 65 |
| 56 /// Writes the characters of [string] on [buffer]. The characters | 66 /// Writes the characters of [string] on [buffer]. The characters |
| 57 /// are escaped as suitable for JavaScript and JSON. [buffer] is | 67 /// are escaped as suitable for JavaScript and JSON. [buffer] is |
| 58 /// anything which supports [:write:] and [:writeCharCode:], for example, | 68 /// anything which supports [:write:] and [:writeCharCode:], for example, |
| 59 /// [StringBuffer]. Note that JS supports \xnn and \unnnn whereas JSON only | 69 /// [StringBuffer]. Note that JS supports \xnn and \unnnn whereas JSON only |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (isAbstract) builder.addLast('abstract'); | 156 if (isAbstract) builder.addLast('abstract'); |
| 147 if (isFinal) builder.addLast('final'); | 157 if (isFinal) builder.addLast('final'); |
| 148 if (isVar) builder.addLast('var'); | 158 if (isVar) builder.addLast('var'); |
| 149 if (isConst) builder.addLast('const'); | 159 if (isConst) builder.addLast('const'); |
| 150 if (isFactory) builder.addLast('factory'); | 160 if (isFactory) builder.addLast('factory'); |
| 151 if (isExternal) builder.addLast('external'); | 161 if (isExternal) builder.addLast('external'); |
| 152 StringBuffer buffer = new StringBuffer(); | 162 StringBuffer buffer = new StringBuffer(); |
| 153 builder.toLink().printOn(buffer, ', '); | 163 builder.toLink().printOn(buffer, ', '); |
| 154 return buffer.toString(); | 164 return buffer.toString(); |
| 155 } | 165 } |
| OLD | NEW |