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 * 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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 } | 800 } |
801 } | 801 } |
802 | 802 |
803 // Methods required by ListMixin | 803 // Methods required by ListMixin |
804 | 804 |
805 E operator [](index) { | 805 E operator [](index) { |
806 if (index is int) { | 806 if (index is int) { |
807 _checkIndex(index); | 807 _checkIndex(index); |
808 } | 808 } |
809 | 809 |
810 // Lazily create the Dart class that wraps the JS object when the object in | 810 return super[index]; |
811 // a list if fetched. | |
812 var wrap_entry = html.wrap_jso(super[index]); | |
813 super[index] = wrap_entry; | |
814 return wrap_entry; | |
815 } | 811 } |
816 | 812 |
817 void operator []=(index, E value) { | 813 void operator []=(index, E value) { |
818 if (index is int) { | 814 if (index is int) { |
819 _checkIndex(index); | 815 _checkIndex(index); |
820 } | 816 } |
821 super[index] = value; | 817 super[index] = value; |
822 } | 818 } |
823 | 819 |
824 int get length native "JsArray_length"; | 820 int get length native "JsArray_length"; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 | 881 |
886 /** | 882 /** |
887 * Returns a method that can be called with an arbitrary number (for n less | 883 * Returns a method that can be called with an arbitrary number (for n less |
888 * than 11) of arguments without violating Dart type checks. | 884 * than 11) of arguments without violating Dart type checks. |
889 */ | 885 */ |
890 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => | 886 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => |
891 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED, | 887 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED, |
892 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED, | 888 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED, |
893 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly( | 889 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly( |
894 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])); | 890 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])); |
OLD | NEW |