| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 JS('void', r'#.fixed$length = Array', list); | 76 JS('void', r'#.fixed$length = Array', list); |
| 77 return JS('JSFixedArray', '#', list); | 77 return JS('JSFixedArray', '#', list); |
| 78 } | 78 } |
| 79 | 79 |
| 80 static List markUnmodifiableList(List list) { | 80 static List markUnmodifiableList(List list) { |
| 81 // Functions are stored in the hidden class and not as properties in | 81 // Functions are stored in the hidden class and not as properties in |
| 82 // the object. We never actually look at the value, but only want | 82 // the object. We never actually look at the value, but only want |
| 83 // to know if the property exists. | 83 // to know if the property exists. |
| 84 JS('void', r'#.fixed$length = Array', list); | 84 JS('void', r'#.fixed$length = Array', list); |
| 85 JS('void', r'#.immutable$list = Array', list); | 85 JS('void', r'#.immutable$list = Array', list); |
| 86 return JS('List', '#', list); | 86 // TODO(23309): Make it detectable that the list has fixed length. |
| 87 return JS('JSArray', '#', list); |
| 87 } | 88 } |
| 88 | 89 |
| 89 checkMutable(reason) { | 90 checkMutable(reason) { |
| 90 if (this is !JSMutableArray) { | 91 if (this is !JSMutableArray) { |
| 91 throw new UnsupportedError(reason); | 92 throw new UnsupportedError(reason); |
| 92 } | 93 } |
| 93 } | 94 } |
| 94 | 95 |
| 95 checkGrowable(reason) { | 96 checkGrowable(reason) { |
| 96 if (this is !JSExtendableArray) { | 97 if (this is !JSExtendableArray) { |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 | 640 |
| 640 if (_index >= length) { | 641 if (_index >= length) { |
| 641 _current = null; | 642 _current = null; |
| 642 return false; | 643 return false; |
| 643 } | 644 } |
| 644 _current = _iterable[_index]; | 645 _current = _iterable[_index]; |
| 645 _index++; | 646 _index++; |
| 646 return true; | 647 return true; |
| 647 } | 648 } |
| 648 } | 649 } |
| OLD | NEW |