Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/lib/js_array.dart

Issue 12296011: Version 0.3.7.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 void forEach(void f(E element)) { 87 void forEach(void f(E element)) {
88 return IterableMixinWorkaround.forEach(this, f); 88 return IterableMixinWorkaround.forEach(this, f);
89 } 89 }
90 90
91 Iterable map(f(E element)) { 91 Iterable map(f(E element)) {
92 return IterableMixinWorkaround.mapList(this, f); 92 return IterableMixinWorkaround.mapList(this, f);
93 } 93 }
94 94
95 List mappedBy(f(E element)) {
96 return IterableMixinWorkaround.mappedByList(this, f);
97 }
98
99 String join([String separator]) { 95 String join([String separator]) {
100 if (separator == null) separator = ""; 96 if (separator == null) separator = "";
101 var list = new List(this.length); 97 var list = new List(this.length);
102 for (int i = 0; i < this.length; i++) { 98 for (int i = 0; i < this.length; i++) {
103 list[i] = "${this[i]}"; 99 list[i] = "${this[i]}";
104 } 100 }
105 return JS('String', "#.join(#)", list, separator); 101 return JS('String', "#.join(#)", list, separator);
106 } 102 }
107 103
108 Iterable<E> take(int n) { 104 Iterable<E> take(int n) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 throw new RangeError.value(start + length); 219 throw new RangeError.value(start + length);
224 } 220 }
225 221
226 Arrays.copy(from, startFrom, this, start, length); 222 Arrays.copy(from, startFrom, this, start, length);
227 } 223 }
228 224
229 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f); 225 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f);
230 226
231 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); 227 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f);
232 228
233 List<E> get reversed => IterableMixinWorkaround.reversedList(this); 229 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this);
234 230
235 void sort([int compare(E a, E b)]) { 231 void sort([int compare(E a, E b)]) {
236 checkMutable(this, 'sort'); 232 checkMutable(this, 'sort');
237 IterableMixinWorkaround.sortList(this, compare); 233 IterableMixinWorkaround.sortList(this, compare);
238 } 234 }
239 235
240 int indexOf(E element, [int start = 0]) { 236 int indexOf(E element, [int start = 0]) {
241 if (start is !int) throw new ArgumentError(start); 237 if (start is !int) throw new ArgumentError(start);
242 return Arrays.indexOf(this, element, start, length); 238 return Arrays.indexOf(this, element, start, length);
243 } 239 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return JS('var', '#[#]', this, index); 282 return JS('var', '#[#]', this, index);
287 } 283 }
288 284
289 void operator []=(int index, E value) { 285 void operator []=(int index, E value) {
290 checkMutable(this, 'indexed set'); 286 checkMutable(this, 'indexed set');
291 if (index is !int) throw new ArgumentError(index); 287 if (index is !int) throw new ArgumentError(index);
292 if (index >= length || index < 0) throw new RangeError.value(index); 288 if (index >= length || index < 0) throw new RangeError.value(index);
293 JS('void', r'#[#] = #', this, index, value); 289 JS('void', r'#[#] = #', this, index, value);
294 } 290 }
295 } 291 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698