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