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

Side by Side Diff: tests/compiler/dart2js/list_tracer3_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 // We used to always nullify the element type of a list we are tracing in 5 // We used to always nullify the element type of a list we are tracing in
6 // the presence of a fixed length list constructor call. 6 // the presence of a fixed length list constructor call.
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import 10 import
11 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 11 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
12 show ContainerTypeMask, TypeMask; 12 show ContainerTypeMask, TypeMask;
13 13
14 import 'compiler_helper.dart'; 14 import 'compiler_helper.dart';
15 import 'parser_helper.dart'; 15 import 'parser_helper.dart';
16 import 'type_mask_test_helper.dart';
16 17
17 18
18 const String TEST = r''' 19 const String TEST = r'''
19 var myList = []; 20 var myList = [];
20 var otherList = ['foo', 42]; 21 var otherList = ['foo', 42];
21 main() { 22 main() {
22 var a = otherList[0]; 23 var a = otherList[0];
23 a += 54; 24 a += 54;
24 myList.add(a); 25 myList.add(a);
25 } 26 }
26 '''; 27 ''';
27 28
28 void main() { 29 void main() {
29 Uri uri = new Uri(scheme: 'source'); 30 Uri uri = new Uri(scheme: 'source');
30 var compiler = compilerFor(TEST, uri); 31 var compiler = compilerFor(TEST, uri);
31 asyncTest(() => compiler.runCompiler(uri).then((_) { 32 asyncTest(() => compiler.runCompiler(uri).then((_) {
32 var typesInferrer = compiler.typesTask.typesInferrer; 33 var typesInferrer = compiler.typesTask.typesInferrer;
33 34
34 checkType(String name, type) { 35 checkType(String name, type) {
35 var element = findElement(compiler, name); 36 var element = findElement(compiler, name);
36 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element); 37 ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
37 Expect.equals(type, mask.elementType.simplify(compiler), name); 38 Expect.equals(type, simplify(mask.elementType, compiler), name);
38 } 39 }
39 40
40 var interceptorType = 41 var interceptorType =
41 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 42 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
42 43
43 checkType('myList', interceptorType); 44 checkType('myList', interceptorType);
44 })); 45 }));
45 } 46 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/list_tracer2_test.dart ('k') | tests/compiler/dart2js/list_tracer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698