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

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

Issue 165143004: Move TypeMask.simplify to a test helper. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 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) 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 "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 7 import
8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
9 show ContainerTypeMask, TypeMask; 9 show ContainerTypeMask, TypeMask;
10 10
11 import 'compiler_helper.dart'; 11 import 'compiler_helper.dart';
12 import 'parser_helper.dart'; 12 import 'parser_helper.dart';
13 13 import 'type_mask_test_helper.dart';
14 14
15 String generateTest(String listAllocation) { 15 String generateTest(String listAllocation) {
16 return """ 16 return """
17 int anInt = 42; 17 int anInt = 42;
18 double aDouble = 42.5; 18 double aDouble = 42.5;
19 19
20 class A { 20 class A {
21 final field; 21 final field;
22 var nonFinalField; 22 var nonFinalField;
23 23
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 var compiler = compilerFor(generateTest(allocation), uri, 201 var compiler = compilerFor(generateTest(allocation), uri,
202 allowErrors: false, allowWarnings: false); 202 allowErrors: false, allowWarnings: false);
203 asyncTest(() => compiler.runCompiler(uri).then((_) { 203 asyncTest(() => compiler.runCompiler(uri).then((_) {
204 var typesTask = compiler.typesTask; 204 var typesTask = compiler.typesTask;
205 var typesInferrer = typesTask.typesInferrer; 205 var typesInferrer = typesTask.typesInferrer;
206 206
207 checkType(String name, type) { 207 checkType(String name, type) {
208 var element = findElement(compiler, name); 208 var element = findElement(compiler, name);
209 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element); 209 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
210 if (nullify) type = type.nullable(); 210 if (nullify) type = type.nullable();
211 Expect.equals(type, mask.elementType.simplify(compiler), name); 211 Expect.equals(type, simplify(mask.elementType, compiler), name);
212 } 212 }
213 213
214 checkType('listInField', typesTask.numType); 214 checkType('listInField', typesTask.numType);
215 checkType('listPassedToMethod', typesTask.numType); 215 checkType('listPassedToMethod', typesTask.numType);
216 checkType('listReturnedFromMethod', typesTask.numType); 216 checkType('listReturnedFromMethod', typesTask.numType);
217 checkType('listUsedWithCascade', typesTask.numType); 217 checkType('listUsedWithCascade', typesTask.numType);
218 checkType('listUsedInClosure', typesTask.numType); 218 checkType('listUsedInClosure', typesTask.numType);
219 checkType('listPassedToSelector', typesTask.numType); 219 checkType('listPassedToSelector', typesTask.numType);
220 checkType('listReturnedFromSelector', typesTask.numType); 220 checkType('listReturnedFromSelector', typesTask.numType);
221 checkType('listUsedWithAddAndInsert', typesTask.numType); 221 checkType('listUsedWithAddAndInsert', typesTask.numType);
(...skipping 14 matching lines...) Expand all
236 checkType('listPassedAsNamedParameter', typesTask.numType); 236 checkType('listPassedAsNamedParameter', typesTask.numType);
237 checkType('listStoredInList', typesTask.uint31Type); 237 checkType('listStoredInList', typesTask.uint31Type);
238 checkType('listStoredInListButEscapes', typesTask.dynamicType); 238 checkType('listStoredInListButEscapes', typesTask.dynamicType);
239 239
240 if (!allocation.contains('filled')) { 240 if (!allocation.contains('filled')) {
241 checkType('listUnset', new TypeMask.nonNullEmpty()); 241 checkType('listUnset', new TypeMask.nonNullEmpty());
242 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty()); 242 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty());
243 } 243 }
244 })); 244 }));
245 } 245 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/list_tracer3_test.dart ('k') | tests/compiler/dart2js/map_tracer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698