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

Side by Side Diff: tests/compiler/dart2js/list_tracer_test.dart

Issue 17759007: First pass at asynchronous input loading in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import 6 import
7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
8 show ContainerTypeMask, TypeMask; 8 show ContainerTypeMask, TypeMask;
9 9
10 import 'compiler_helper.dart'; 10 import 'compiler_helper.dart';
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 doTest('[]', nullify: false); // Test literal list. 182 doTest('[]', nullify: false); // Test literal list.
183 doTest('new List()', nullify: false); // Test growable list. 183 doTest('new List()', nullify: false); // Test growable list.
184 doTest('new List(1)', nullify: true); // Test fixed list. 184 doTest('new List(1)', nullify: true); // Test fixed list.
185 doTest('new List.filled(1, 0)', nullify: false); // Test List.filled. 185 doTest('new List.filled(1, 0)', nullify: false); // Test List.filled.
186 doTest('new List.filled(1, null)', nullify: true); // Test List.filled. 186 doTest('new List.filled(1, null)', nullify: true); // Test List.filled.
187 } 187 }
188 188
189 void doTest(String allocation, {bool nullify}) { 189 void doTest(String allocation, {bool nullify}) {
190 Uri uri = new Uri(scheme: 'source'); 190 Uri uri = new Uri(scheme: 'source');
191 var compiler = compilerFor(generateTest(allocation), uri); 191 var compiler = compilerFor(generateTest(allocation), uri);
192 compiler.runCompiler(uri); 192 compiler.runCompiler(uri).then((_) {
193 var typesInferrer = compiler.typesTask.typesInferrer; 193 var typesInferrer = compiler.typesTask.typesInferrer;
194 194
195 checkType(String name, type) { 195 checkType(String name, type) {
196 var element = findElement(compiler, name); 196 var element = findElement(compiler, name);
197 ContainerTypeMask mask = typesInferrer.internal.typeOf[element]; 197 ContainerTypeMask mask = typesInferrer.internal.typeOf[element];
198 if (nullify) type = type.nullable(); 198 if (nullify) type = type.nullable();
199 Expect.equals(type, mask.elementType.simplify(compiler), name); 199 Expect.equals(type, mask.elementType.simplify(compiler), name);
200 } 200 }
201 201
202 checkType('listInField', typesInferrer.numType); 202 checkType('listInField', typesInferrer.numType);
203 checkType('listPassedToMethod', typesInferrer.numType); 203 checkType('listPassedToMethod', typesInferrer.numType);
204 checkType('listReturnedFromMethod', typesInferrer.numType); 204 checkType('listReturnedFromMethod', typesInferrer.numType);
205 checkType('listUsedWithCascade', typesInferrer.numType); 205 checkType('listUsedWithCascade', typesInferrer.numType);
206 checkType('listUsedInClosure', typesInferrer.numType); 206 checkType('listUsedInClosure', typesInferrer.numType);
207 checkType('listPassedToSelector', typesInferrer.numType); 207 checkType('listPassedToSelector', typesInferrer.numType);
208 checkType('listReturnedFromSelector', typesInferrer.numType); 208 checkType('listReturnedFromSelector', typesInferrer.numType);
209 checkType('listUsedWithAddAndInsert', typesInferrer.numType); 209 checkType('listUsedWithAddAndInsert', typesInferrer.numType);
210 checkType('listUsedWithConstraint', typesInferrer.numType); 210 checkType('listUsedWithConstraint', typesInferrer.numType);
211 checkType('listEscapingFromSetter', typesInferrer.numType); 211 checkType('listEscapingFromSetter', typesInferrer.numType);
212 checkType('listUsedInLocal', typesInferrer.numType); 212 checkType('listUsedInLocal', typesInferrer.numType);
213 checkType('listEscapingInSetterValue', typesInferrer.numType); 213 checkType('listEscapingInSetterValue', typesInferrer.numType);
214 checkType('listEscapingInIndex', typesInferrer.numType); 214 checkType('listEscapingInIndex', typesInferrer.numType);
215 checkType('listEscapingInIndexSet', typesInferrer.intType); 215 checkType('listEscapingInIndexSet', typesInferrer.intType);
216 checkType('listEscapingTwiceInIndexSet', typesInferrer.numType); 216 checkType('listEscapingTwiceInIndexSet', typesInferrer.numType);
217 checkType('listSetInNonFinalField', typesInferrer.numType); 217 checkType('listSetInNonFinalField', typesInferrer.numType);
218 checkType('listWithChangedLength', typesInferrer.intType.nullable()); 218 checkType('listWithChangedLength', typesInferrer.intType.nullable());
219 219
220 checkType('listPassedToClosure', typesInferrer.dynamicType); 220 checkType('listPassedToClosure', typesInferrer.dynamicType);
221 checkType('listReturnedFromClosure', typesInferrer.dynamicType); 221 checkType('listReturnedFromClosure', typesInferrer.dynamicType);
222 checkType('listUsedWithNonOkSelector', typesInferrer.dynamicType); 222 checkType('listUsedWithNonOkSelector', typesInferrer.dynamicType);
223 checkType('listPassedAsOptionalParameter', typesInferrer.dynamicType); 223 checkType('listPassedAsOptionalParameter', typesInferrer.dynamicType);
224 checkType('listPassedAsNamedParameter', typesInferrer.dynamicType); 224 checkType('listPassedAsNamedParameter', typesInferrer.dynamicType);
225 225
226 if (!allocation.contains('filled')) { 226 if (!allocation.contains('filled')) {
227 checkType('listUnset', new TypeMask.nonNullEmpty()); 227 checkType('listUnset', new TypeMask.nonNullEmpty());
228 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty()); 228 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty());
229 } 229 }
230 });
230 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698