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 part of dart._interceptors; | 5 part of dart._interceptors; |
6 | 6 |
7 /** | 7 /** |
8 * The interceptor class for [List]. The compiler recognizes this | 8 * The interceptor class for [List]. The compiler recognizes this |
9 * class as an interceptor, and changes references to [:this:] to | 9 * class as an interceptor, and changes references to [:this:] to |
10 * actually use the receiver of the method, which is generated as an extra | 10 * actually use the receiver of the method, which is generated as an extra |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 JS('int', '#', index) >= JS('int', '#.length', this) || | 573 JS('int', '#', index) >= JS('int', '#.length', this) || |
574 JS('int', '#', index) < 0) { | 574 JS('int', '#', index) < 0) { |
575 throw diagnoseIndexError(this, index); | 575 throw diagnoseIndexError(this, index); |
576 } | 576 } |
577 JS('void', r'#[#] = #', this, index, value); | 577 JS('void', r'#[#] = #', this, index, value); |
578 } | 578 } |
579 | 579 |
580 Map<int, E> asMap() { | 580 Map<int, E> asMap() { |
581 return new ListMapView<E>(this); | 581 return new ListMapView<E>(this); |
582 } | 582 } |
| 583 |
| 584 Type get runtimeType => wrapType(JS('', '#(#)', getGenericClass(List), E)); |
583 } | 585 } |
584 | 586 |
585 /** | 587 /** |
586 * Dummy subclasses that allow the backend to track more precise | 588 * Dummy subclasses that allow the backend to track more precise |
587 * information about arrays through their type. The CPA type inference | 589 * information about arrays through their type. The CPA type inference |
588 * relies on the fact that these classes do not override [] nor []=. | 590 * relies on the fact that these classes do not override [] nor []=. |
589 * | 591 * |
590 * These classes are really a fiction, and can have no methods, since | 592 * These classes are really a fiction, and can have no methods, since |
591 * getInterceptor always returns JSArray. We should consider pushing the | 593 * getInterceptor always returns JSArray. We should consider pushing the |
592 * 'isGrowable' and 'isMutable' checks into the getInterceptor implementation so | 594 * 'isGrowable' and 'isMutable' checks into the getInterceptor implementation so |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 630 |
629 if (_index >= length) { | 631 if (_index >= length) { |
630 _current = null; | 632 _current = null; |
631 return false; | 633 return false; |
632 } | 634 } |
633 _current = _iterable[_index]; | 635 _current = _iterable[_index]; |
634 _index++; | 636 _index++; |
635 return true; | 637 return true; |
636 } | 638 } |
637 } | 639 } |
OLD | NEW |