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

Side by Side Diff: test/dart_codegen/expect/core/list.dart

Issue 1131143002: Angular workarounds (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase on latest Created 5 years, 7 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
OLDNEW
1 part of dart.core; 1 part of dart.core;
2 @SupportJsExtensionMethod() @JsPeerInterface(name: 'Array') abstract class List <E> implements Iterable<E>, EfficientLength {external factory List([int length]) ; 2 @SupportJsExtensionMethod() @JsPeerInterface(name: 'Array') abstract class List <E> implements Iterable<E>, EfficientLength {external factory List([int length]) ;
3 external factory List.filled(int length, E fill); 3 external factory List.filled(int length, E fill);
4 external factory List.from(Iterable elements, { 4 external factory List.from(Iterable elements, {
5 bool growable : true} 5 bool growable : true}
6 ); 6 );
7 factory List.generate(int length, E generator(int index), { 7 factory List.generate(int length, E generator(int index), {
8 bool growable : true} 8 bool growable : true}
9 ) { 9 ) {
10 List<E> result; 10 List<E> result;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (this[i] == other) return true; 102 if (this[i] == other) return true;
103 } 103 }
104 return false; 104 return false;
105 } 105 }
106 bool get isEmpty => length == 0; 106 bool get isEmpty => length == 0;
107 bool get isNotEmpty => !isEmpty; 107 bool get isNotEmpty => !isEmpty;
108 String toString() => ListBase.listToString(this); 108 String toString() => ListBase.listToString(this);
109 List<E> toList({ 109 List<E> toList({
110 bool growable : true} 110 bool growable : true}
111 ) { 111 ) {
112 if (growable) { 112 return ((__x14) => DEVC$RT.cast(__x14, dynamic, DEVC$RT.type((List<E> _) {
113 return new JSArray<E>.markGrowable(JS('', '#.slice()', this));
114 } 113 }
115 else { 114 ), "CompositeCast", """line 248, column 12 of dart:core/list.dart: """, __x14 is List<E>, false))(JS('', 'dart.setType(#.slice(), core.List\$(#))', this, E));
116 return new JSArray<E>.markFixed(JS('', '#.slice()', this));
117 }
118 } 115 }
119 Set<E> toSet() => new Set<E>.from(this); 116 Set<E> toSet() => new Set<E>.from(this);
120 Iterator<E> get iterator => new ListIterator<E>(this); 117 Iterator<E> get iterator => new ListIterator<E>(this);
121 int get hashCode => ((__x14) => DEVC$RT.cast(__x14, dynamic, int, "DynamicCast" , """line 257, column 23 of dart:core/list.dart: """, __x14 is int, true))(Primi tives.objectHashCode(this)); 118 int get hashCode => ((__x15) => DEVC$RT.cast(__x15, dynamic, int, "DynamicCast" , """line 255, column 23 of dart:core/list.dart: """, __x15 is int, true))(Primi tives.objectHashCode(this));
122 E operator [](int index) { 119 E operator [](int index) {
123 if (index is! int) throw new ArgumentError(index); 120 if (index is! int) throw new ArgumentError(index);
124 if (index >= length || index < 0) throw new RangeError.value(index); 121 if (index >= length || index < 0) throw new RangeError.value(index);
125 return ((__x15) => DEVC$RT.cast(__x15, dynamic, E, "CompositeCast", """line 2 68, column 12 of dart:core/list.dart: """, __x15 is E, false))(JS('var', '#[#]', this, index)); 122 return ((__x16) => DEVC$RT.cast(__x16, dynamic, E, "CompositeCast", """line 2 66, column 12 of dart:core/list.dart: """, __x16 is E, false))(JS('var', '#[#]', this, index));
126 } 123 }
127 void operator []=(int index, E value) { 124 void operator []=(int index, E value) {
128 checkMutable('indexed set'); 125 checkMutable('indexed set');
129 if (index is! int) throw new ArgumentError(index); 126 if (index is! int) throw new ArgumentError(index);
130 if (index >= length || index < 0) throw new RangeError.value(index); 127 if (index >= length || index < 0) throw new RangeError.value(index);
131 JS('void', r'#[#] = #', this, index, value); 128 JS('void', r'#[#] = #', this, index, value);
132 } 129 }
133 int get length => ((__x16) => DEVC$RT.cast(__x16, dynamic, int, "DynamicCast", """line 287, column 21 of dart:core/list.dart: """, __x16 is int, true))(JS('JSU Int32', r'#.length', this)); 130 int get length => ((__x17) => DEVC$RT.cast(__x17, dynamic, int, "DynamicCast", """line 285, column 21 of dart:core/list.dart: """, __x17 is int, true))(JS('JSU Int32', r'#.length', this));
134 void set length(int newLength) { 131 void set length(int newLength) {
135 if (newLength is! int) throw new ArgumentError(newLength); 132 if (newLength is! int) throw new ArgumentError(newLength);
136 if (newLength < 0) throw new RangeError.value(newLength); 133 if (newLength < 0) throw new RangeError.value(newLength);
137 checkGrowable('set length'); 134 checkGrowable('set length');
138 JS('void', r'#.length = #', this, newLength); 135 JS('void', r'#.length = #', this, newLength);
139 } 136 }
140 void add(E value) { 137 void add(E value) {
141 checkGrowable('add'); 138 checkGrowable('add');
142 JS('void', r'#.push(#)', this, value); 139 JS('void', r'#.push(#)', this, value);
143 } 140 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 185 }
189 } 186 }
190 return false; 187 return false;
191 } 188 }
192 E removeAt(int index) { 189 E removeAt(int index) {
193 if (index is! int) throw new ArgumentError(index); 190 if (index is! int) throw new ArgumentError(index);
194 if (index < 0 || index >= length) { 191 if (index < 0 || index >= length) {
195 throw new RangeError.value(index); 192 throw new RangeError.value(index);
196 } 193 }
197 checkGrowable('removeAt'); 194 checkGrowable('removeAt');
198 return ((__x17) => DEVC$RT.cast(__x17, dynamic, E, "CompositeCast", """line 5 19, column 12 of dart:core/list.dart: """, __x17 is E, false))(JS('var', r'#.spl ice(#, 1)[0]', this, index)); 195 return ((__x18) => DEVC$RT.cast(__x18, dynamic, E, "CompositeCast", """line 5 17, column 12 of dart:core/list.dart: """, __x18 is E, false))(JS('var', r'#.spl ice(#, 1)[0]', this, index));
199 } 196 }
200 E removeLast() { 197 E removeLast() {
201 checkGrowable('removeLast'); 198 checkGrowable('removeLast');
202 if (length == 0) throw new RangeError.value(-1); 199 if (length == 0) throw new RangeError.value(-1);
203 return ((__x18) => DEVC$RT.cast(__x18, dynamic, E, "CompositeCast", """line 5 30, column 12 of dart:core/list.dart: """, __x18 is E, false))(JS('var', r'#.pop ()', this)); 200 return ((__x19) => DEVC$RT.cast(__x19, dynamic, E, "CompositeCast", """line 5 28, column 12 of dart:core/list.dart: """, __x19 is E, false))(JS('var', r'#.pop ()', this));
204 } 201 }
205 void removeWhere(bool test(E element)) { 202 void removeWhere(bool test(E element)) {
206 IterableMixinWorkaround.removeWhereList(this, test); 203 IterableMixinWorkaround.removeWhereList(this, test);
207 } 204 }
208 void retainWhere(bool test(E element)) { 205 void retainWhere(bool test(E element)) {
209 IterableMixinWorkaround.removeWhereList(this, (E element) => !test(element)); 206 IterableMixinWorkaround.removeWhereList(this, (E element) => !test(element));
210 } 207 }
211 List<E> sublist(int start, [int end]) { 208 List<E> sublist(int start, [int end]) {
212 checkNull(start); 209 checkNull(start);
213 if (start is! int) throw new ArgumentError(start); 210 if (start is! int) throw new ArgumentError(start);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue); 247 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue);
251 } 248 }
252 void replaceRange(int start, int end, Iterable<E> replacement) { 249 void replaceRange(int start, int end, Iterable<E> replacement) {
253 checkGrowable('removeRange'); 250 checkGrowable('removeRange');
254 IterableMixinWorkaround.replaceRangeList(this, start, end, replacement); 251 IterableMixinWorkaround.replaceRangeList(this, start, end, replacement);
255 } 252 }
256 Map<int, E> asMap() { 253 Map<int, E> asMap() {
257 return new IterableMixinWorkaround<E>().asMapList(this); 254 return new IterableMixinWorkaround<E>().asMapList(this);
258 } 255 }
259 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698