| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 void forEach(void f(E element)) { | 91 void forEach(void f(E element)) { |
| 92 return IterableMixinWorkaround.forEach(this, f); | 92 return IterableMixinWorkaround.forEach(this, f); |
| 93 } | 93 } |
| 94 | 94 |
| 95 Iterable map(f(E element)) { | 95 Iterable map(f(E element)) { |
| 96 return IterableMixinWorkaround.mapList(this, f); | 96 return IterableMixinWorkaround.mapList(this, f); |
| 97 } | 97 } |
| 98 | 98 |
| 99 String join([String separator]) { | 99 String join([String separator = ""]) { |
| 100 if (separator == null) separator = ""; | |
| 101 var list = new List(this.length); | 100 var list = new List(this.length); |
| 102 for (int i = 0; i < this.length; i++) { | 101 for (int i = 0; i < this.length; i++) { |
| 103 list[i] = "${this[i]}"; | 102 list[i] = "${this[i]}"; |
| 104 } | 103 } |
| 105 return JS('String', "#.join(#)", list, separator); | 104 return JS('String', "#.join(#)", list, separator); |
| 106 } | 105 } |
| 107 | 106 |
| 108 Iterable<E> take(int n) { | 107 Iterable<E> take(int n) { |
| 109 return IterableMixinWorkaround.takeList(this, n); | 108 return IterableMixinWorkaround.takeList(this, n); |
| 110 } | 109 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 317 } |
| 319 } | 318 } |
| 320 | 319 |
| 321 /** | 320 /** |
| 322 * Dummy subclasses that allow the backend to track more precise | 321 * Dummy subclasses that allow the backend to track more precise |
| 323 * information about arrays through their type. | 322 * information about arrays through their type. |
| 324 */ | 323 */ |
| 325 class JSMutableArray extends JSArray {} | 324 class JSMutableArray extends JSArray {} |
| 326 class JSFixedArray extends JSMutableArray {} | 325 class JSFixedArray extends JSMutableArray {} |
| 327 class JSExtendableArray extends JSMutableArray {} | 326 class JSExtendableArray extends JSMutableArray {} |
| OLD | NEW |