| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 _foreign_helper; | 5 library _foreign_helper; |
| 6 | 6 |
| 7 import 'dart:_js_embedded_names' show JsGetName, JsBuiltin; | 7 import 'dart:_js_embedded_names' show JsGetName, JsBuiltin; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Emits a JavaScript code fragment parameterized by arguments. | 10 * Emits a JavaScript code fragment parameterized by arguments. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 * type in Dart that is this precise. The Dart alternative would be `Object` | 34 * type in Dart that is this precise. The Dart alternative would be `Object` |
| 35 * or `dynamic`, but these types imply that the JS-code might also be | 35 * or `dynamic`, but these types imply that the JS-code might also be |
| 36 * creating instances of all the DOM types. | 36 * creating instances of all the DOM types. |
| 37 * | 37 * |
| 38 * If `null` is possible, it must be specified explicitly, e.g. | 38 * If `null` is possible, it must be specified explicitly, e.g. |
| 39 * `"String|Null"`. [typeDescription] has several extensions to help describe | 39 * `"String|Null"`. [typeDescription] has several extensions to help describe |
| 40 * the behavior more accurately. In addition to the union type already | 40 * the behavior more accurately. In addition to the union type already |
| 41 * described: | 41 * described: |
| 42 * | 42 * |
| 43 * + `=Object` is a plain JavaScript object. Some DOM methods return | 43 * + `=Object` is a plain JavaScript object. Some DOM methods return |
| 44 * instances that have no corresponing Dart type (e.g. cross-frame | 44 * instances that have no corresponding Dart type (e.g. cross-frame |
| 45 * documents), `=Object` can be used to describe these untyped' values. | 45 * documents), `=Object` can be used to describe these untyped' values. |
| 46 * | 46 * |
| 47 * + `var` (or empty string). If the entire [typeDescription] is `var` (or | 47 * + `var` (or empty string). If the entire [typeDescription] is `var` (or |
| 48 * empty string) then the type is `dynamic` but the code is known to not | 48 * empty string) then the type is `dynamic` but the code is known to not |
| 49 * create any instances. | 49 * create any instances. |
| 50 * | 50 * |
| 51 * Examples: | 51 * Examples: |
| 52 * | 52 * |
| 53 * // Parent window might be an opaque cross-frame window. | 53 * // Parent window might be an opaque cross-frame window. |
| 54 * var thing = JS('=Object|Window', '#.parent', myWindow); | 54 * var thing = JS('=Object|Window', '#.parent', myWindow); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the | 257 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the |
| 258 * HStringConcat SSA instruction and may be constant-folded. | 258 * HStringConcat SSA instruction and may be constant-folded. |
| 259 */ | 259 */ |
| 260 String JS_STRING_CONCAT(String a, String b) { | 260 String JS_STRING_CONCAT(String a, String b) { |
| 261 // This body is unused, only here for type analysis. | 261 // This body is unused, only here for type analysis. |
| 262 return JS('String', '# + #', a, b); | 262 return JS('String', '# + #', a, b); |
| 263 } | 263 } |
| OLD | NEW |