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 _interceptors; | 5 part of _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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 new JSArray<E>.markFixed(JS('', '#.slice()', this)); | 574 new JSArray<E>.markFixed(JS('', '#.slice()', this)); |
575 | 575 |
576 Set<E> toSet() => new Set<E>.from(this); | 576 Set<E> toSet() => new Set<E>.from(this); |
577 | 577 |
578 Iterator<E> get iterator => new ArrayIterator<E>(this); | 578 Iterator<E> get iterator => new ArrayIterator<E>(this); |
579 | 579 |
580 int get hashCode => Primitives.objectHashCode(this); | 580 int get hashCode => Primitives.objectHashCode(this); |
581 | 581 |
582 int get length => JS('JSUInt32', r'#.length', this); | 582 int get length => JS('JSUInt32', r'#.length', this); |
583 | 583 |
584 void set length(int newLength) { | 584 set length(int newLength) { |
585 checkGrowable('set length'); | 585 checkGrowable('set length'); |
586 if (newLength is !int) { | 586 if (newLength is !int) { |
587 throw new ArgumentError.value(newLength, 'newLength'); | 587 throw new ArgumentError.value(newLength, 'newLength'); |
588 } | 588 } |
589 // TODO(sra): Remove this test and let JavaScript throw an error. | 589 // TODO(sra): Remove this test and let JavaScript throw an error. |
590 if (newLength < 0) { | 590 if (newLength < 0) { |
591 throw new RangeError.range(newLength, 0, null, 'newLength'); | 591 throw new RangeError.range(newLength, 0, null, 'newLength'); |
592 } | 592 } |
593 // JavaScript with throw a RangeError for numbers that are too big. The | 593 // JavaScript with throw a RangeError for numbers that are too big. The |
594 // message does not contain the value. | 594 // message does not contain the value. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 655 |
656 if (_index >= length) { | 656 if (_index >= length) { |
657 _current = null; | 657 _current = null; |
658 return false; | 658 return false; |
659 } | 659 } |
660 _current = _iterable[_index]; | 660 _current = _iterable[_index]; |
661 _index++; | 661 _index++; |
662 return true; | 662 return true; |
663 } | 663 } |
664 } | 664 } |
OLD | NEW |