| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /** | 5 /** |
| 6 * This part contains helpers for supporting runtime type information. | 6 * This part contains helpers for supporting runtime type information. |
| 7 * | 7 * |
| 8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is | 8 * The helper use a mixture of Dart and JavaScript objects. To indicate which is |
| 9 * used where we adopt the scheme of using explicit type annotation for Dart | 9 * used where we adopt the scheme of using explicit type annotation for Dart |
| 10 * objects and 'var' or omitted return type for JavaScript objects. | 10 * objects and 'var' or omitted return type for JavaScript objects. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * Returns a human-readable representation of the type representation [type]. | 127 * Returns a human-readable representation of the type representation [type]. |
| 128 */ | 128 */ |
| 129 String runtimeTypeToString(var type) { | 129 String runtimeTypeToString(var type) { |
| 130 if (isNull(type)) { | 130 if (isNull(type)) { |
| 131 return 'dynamic'; | 131 return 'dynamic'; |
| 132 } else if (isJsArray(type)) { | 132 } else if (isJsArray(type)) { |
| 133 // A list representing a type with arguments. | 133 // A list representing a type with arguments. |
| 134 return getRuntimeTypeAsString(type); | 134 return getRuntimeTypeAsString(type); |
| 135 } else { | 135 } else if (isJsFunction(type)) { |
| 136 // A reference to the constructor. | 136 // A reference to the constructor. |
| 137 return getConstructorName(type); | 137 return getConstructorName(type); |
| 138 } else { |
| 139 return null; |
| 138 } | 140 } |
| 139 } | 141 } |
| 140 | 142 |
| 141 /** | 143 /** |
| 142 * Creates a comma-separated string of human-readable representations of the | 144 * Creates a comma-separated string of human-readable representations of the |
| 143 * type representations in the JavaScript array [types] starting at index | 145 * type representations in the JavaScript array [types] starting at index |
| 144 * [startIndex]. | 146 * [startIndex]. |
| 145 */ | 147 */ |
| 146 String joinArguments(var types, int startIndex) { | 148 String joinArguments(var types, int startIndex) { |
| 147 if (isNull(types)) return ''; | 149 if (isNull(types)) return ''; |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 * and [t] are Dart values. | 707 * and [t] are Dart values. |
| 706 */ | 708 */ |
| 707 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); | 709 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); |
| 708 | 710 |
| 709 /** | 711 /** |
| 710 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We | 712 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We |
| 711 * use this helper to avoid generating code under the invalid assumption that | 713 * use this helper to avoid generating code under the invalid assumption that |
| 712 * [s] and [t] are Dart values. | 714 * [s] and [t] are Dart values. |
| 713 */ | 715 */ |
| 714 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); | 716 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); |
| OLD | NEW |