| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 251 |
| 252 List<E> toList({ bool growable: true }) => | 252 List<E> toList({ bool growable: true }) => |
| 253 new List<E>.from(this, growable: growable); | 253 new List<E>.from(this, growable: growable); |
| 254 | 254 |
| 255 Set<E> toSet() => new Set<E>.from(this); | 255 Set<E> toSet() => new Set<E>.from(this); |
| 256 | 256 |
| 257 Iterator<E> get iterator => new ListIterator<E>(this); | 257 Iterator<E> get iterator => new ListIterator<E>(this); |
| 258 | 258 |
| 259 int get hashCode => Primitives.objectHashCode(this); | 259 int get hashCode => Primitives.objectHashCode(this); |
| 260 | 260 |
| 261 Type get runtimeType { | |
| 262 // Call getRuntimeTypeString to get the name including type arguments. | |
| 263 return new TypeImpl(getRuntimeTypeString(this)); | |
| 264 } | |
| 265 | |
| 266 int get length => JS('int', r'#.length', this); | 261 int get length => JS('int', r'#.length', this); |
| 267 | 262 |
| 268 void set length(int newLength) { | 263 void set length(int newLength) { |
| 269 if (newLength is !int) throw new ArgumentError(newLength); | 264 if (newLength is !int) throw new ArgumentError(newLength); |
| 270 if (newLength < 0) throw new RangeError.value(newLength); | 265 if (newLength < 0) throw new RangeError.value(newLength); |
| 271 checkGrowable(this, 'set length'); | 266 checkGrowable(this, 'set length'); |
| 272 JS('void', r'#.length = #', this, newLength); | 267 JS('void', r'#.length = #', this, newLength); |
| 273 } | 268 } |
| 274 | 269 |
| 275 E operator [](int index) { | 270 E operator [](int index) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 290 } | 285 } |
| 291 } | 286 } |
| 292 | 287 |
| 293 /** | 288 /** |
| 294 * Dummy subclasses that allow the backend to track more precise | 289 * Dummy subclasses that allow the backend to track more precise |
| 295 * information about arrays through their type. | 290 * information about arrays through their type. |
| 296 */ | 291 */ |
| 297 class JSMutableArray extends JSArray {} | 292 class JSMutableArray extends JSArray {} |
| 298 class JSFixedArray extends JSMutableArray {} | 293 class JSFixedArray extends JSMutableArray {} |
| 299 class JSExtendableArray extends JSMutableArray {} | 294 class JSExtendableArray extends JSMutableArray {} |
| OLD | NEW |