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 dart._foreign_helper; | 5 library dart._foreign_helper; |
6 | 6 |
7 /** | 7 /** |
8 * Emits a JavaScript code fragment parameterized by arguments. | 8 * Emits a JavaScript code fragment parameterized by arguments. |
9 * | 9 * |
10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order | 10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 | 275 |
276 /** | 276 /** |
277 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the | 277 * JavaScript string concatenation. Inputs must be Strings. Corresponds to the |
278 * HStringConcat SSA instruction and may be constant-folded. | 278 * HStringConcat SSA instruction and may be constant-folded. |
279 */ | 279 */ |
280 String JS_STRING_CONCAT(String a, String b) { | 280 String JS_STRING_CONCAT(String a, String b) { |
281 // This body is unused, only here for type analysis. | 281 // This body is unused, only here for type analysis. |
282 return JS('String', '# + #', a, b); | 282 return JS('String', '# + #', a, b); |
283 } | 283 } |
| 284 |
| 285 /// Same `@rest` annotation and `spread` function as in |
| 286 /// `package:js/src/varargs.dart`. |
| 287 /// |
| 288 /// Runtime files cannot import packages, which is why we have an ad-hoc copy. |
| 289 |
| 290 class _Rest { |
| 291 const _Rest(); |
| 292 } |
| 293 |
| 294 const _Rest rest = const _Rest(); |
| 295 |
| 296 dynamic spread(args) { |
| 297 throw new StateError( |
| 298 'The spread function cannot be called, ' |
| 299 'it should be compiled away.'); |
| 300 } |
OLD | NEW |