| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 * Support for interoperating with JavaScript. | 6 * Support for interoperating with JavaScript. |
| 7 * | 7 * |
| 8 * This library provides access to JavaScript objects from Dart, allowing | 8 * This library provides access to JavaScript objects from Dart, allowing |
| 9 * Dart code to get and set properties, and call methods of JavaScript objects | 9 * Dart code to get and set properties, and call methods of JavaScript objects |
| 10 * and invoke JavaScript functions. The library takes care of converting | 10 * and invoke JavaScript functions. The library takes care of converting |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 args == null ? null : new List.from(args.map(_convertToJS)))); | 310 args == null ? null : new List.from(args.map(_convertToJS)))); |
| 311 } | 311 } |
| 312 | 312 |
| 313 // TODO(jmesserly): this is totally unnecessary in dev_compiler. | 313 // TODO(jmesserly): this is totally unnecessary in dev_compiler. |
| 314 /** A [List] that proxies a JavaScript array. */ | 314 /** A [List] that proxies a JavaScript array. */ |
| 315 class JsArray<E> extends JsObject with ListMixin<E> { | 315 class JsArray<E> extends JsObject with ListMixin<E> { |
| 316 | 316 |
| 317 /** | 317 /** |
| 318 * Creates a new JavaScript array. | 318 * Creates a new JavaScript array. |
| 319 */ | 319 */ |
| 320 // TODO(vsm): Making this a factory to workaround #537. | 320 JsArray() : super._fromJs([]); |
| 321 factory JsArray() { return new JsArray._fromJs([]); } | |
| 322 | 321 |
| 323 /** | 322 /** |
| 324 * Creates a new JavaScript array and initializes it to the contents of | 323 * Creates a new JavaScript array and initializes it to the contents of |
| 325 * [other]. | 324 * [other]. |
| 326 */ | 325 */ |
| 327 JsArray.from(Iterable<E> other) | 326 JsArray.from(Iterable<E> other) |
| 328 : super._fromJs([]..addAll(other.map(_convertToJS))); | 327 : super._fromJs([]..addAll(other.map(_convertToJS))); |
| 329 | 328 |
| 330 JsArray._fromJs(jsObject) : super._fromJs(jsObject); | 329 JsArray._fromJs(jsObject) : super._fromJs(jsObject); |
| 331 | 330 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 ' for (let arg of arguments) {' | 550 ' for (let arg of arguments) {' |
| 552 ' args.push(arg);' | 551 ' args.push(arg);' |
| 553 ' }' | 552 ' }' |
| 554 ' return #(...args);' | 553 ' return #(...args);' |
| 555 '}', | 554 '}', |
| 556 f); | 555 f); |
| 557 _interopCaptureThisExpando[f] = ret; | 556 _interopCaptureThisExpando[f] = ret; |
| 558 } | 557 } |
| 559 return ret; | 558 return ret; |
| 560 } | 559 } |
| OLD | NEW |