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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 if (!growable) markFixedList(list); | 534 if (!growable) markFixedList(list); |
535 return new JSArray<E>.typed(list); | 535 return new JSArray<E>.typed(list); |
536 } | 536 } |
537 | 537 |
538 Set<E> toSet() => new Set<E>.from(this); | 538 Set<E> toSet() => new Set<E>.from(this); |
539 | 539 |
540 Iterator<E> get iterator => new ArrayIterator<E>(this); | 540 Iterator<E> get iterator => new ArrayIterator<E>(this); |
541 | 541 |
542 int get hashCode => Primitives.objectHashCode(this); | 542 int get hashCode => Primitives.objectHashCode(this); |
543 | 543 |
| 544 bool operator ==(other) => identical(this, other); |
| 545 |
544 int get length => JS('int', r'#.length', this); | 546 int get length => JS('int', r'#.length', this); |
545 | 547 |
546 void set length(int newLength) { | 548 void set length(int newLength) { |
547 checkGrowable('set length'); | 549 checkGrowable('set length'); |
548 if (newLength is! int) { | 550 if (newLength is! int) { |
549 throw new ArgumentError.value(newLength, 'newLength'); | 551 throw new ArgumentError.value(newLength, 'newLength'); |
550 } | 552 } |
551 // TODO(sra): Remove this test and let JavaScript throw an error. | 553 // TODO(sra): Remove this test and let JavaScript throw an error. |
552 if (newLength < 0) { | 554 if (newLength < 0) { |
553 throw new RangeError.range(newLength, 0, null, 'newLength'); | 555 throw new RangeError.range(newLength, 0, null, 'newLength'); |
(...skipping 74 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 |