| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 | 226 |
| 227 /** | 227 /** |
| 228 * Applies the [substitution] on the [arguments]. | 228 * Applies the [substitution] on the [arguments]. |
| 229 * | 229 * |
| 230 * See the comment in the beginning of this file for a description of the | 230 * See the comment in the beginning of this file for a description of the |
| 231 * possible values for [substitution]. | 231 * possible values for [substitution]. |
| 232 */ | 232 */ |
| 233 substitute(var substitution, var arguments) { | 233 substitute(var substitution, var arguments) { |
| 234 assert(isNull(substitution) || | 234 assert(isNull(substitution) || |
| 235 isJsArray(substitution) || | |
| 236 isJsFunction(substitution)); | 235 isJsFunction(substitution)); |
| 237 assert(isNull(arguments) || isJsArray(arguments)); | 236 assert(isNull(arguments) || isJsArray(arguments)); |
| 238 if (isJsArray(substitution)) { | 237 if (isJsFunction(substitution)) { |
| 239 arguments = substitution; | |
| 240 } else if (isJsFunction(substitution)) { | |
| 241 substitution = invoke(substitution, arguments); | 238 substitution = invoke(substitution, arguments); |
| 242 if (isJsArray(substitution)) { | 239 if (isJsArray(substitution)) { |
| 243 arguments = substitution; | 240 arguments = substitution; |
| 244 } else if (isJsFunction(substitution)) { | 241 } else if (isJsFunction(substitution)) { |
| 245 // TODO(johnniwinther): Check if this is still needed. | 242 // TODO(johnniwinther): Check if this is still needed. |
| 246 arguments = invoke(substitution, arguments); | 243 arguments = invoke(substitution, arguments); |
| 247 } | 244 } |
| 248 } | 245 } |
| 249 return arguments; | 246 return arguments; |
| 250 } | 247 } |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 * and [t] are Dart values. | 694 * and [t] are Dart values. |
| 698 */ | 695 */ |
| 699 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); | 696 bool isIdentical(var s, var t) => JS('bool', '# === #', s, t); |
| 700 | 697 |
| 701 /** | 698 /** |
| 702 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We | 699 * Returns [:true:] if the JavaScript values [s] and [t] are not identical. We |
| 703 * use this helper to avoid generating code under the invalid assumption that | 700 * use this helper to avoid generating code under the invalid assumption that |
| 704 * [s] and [t] are Dart values. | 701 * [s] and [t] are Dart values. |
| 705 */ | 702 */ |
| 706 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); | 703 bool isNotIdentical(var s, var t) => JS('bool', '# !== #', s, t); |
| OLD | NEW |