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

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

Issue 2488353004: Remove Compiler access from ResolutionEnqueuer (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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:async_helper/async_helper.dart"; 5 import "package:async_helper/async_helper.dart";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import 'compiler_helper.dart'; 7 import 'compiler_helper.dart';
8 import 'type_mask_test_helper.dart'; 8 import 'type_mask_test_helper.dart';
9 9
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 main() { 128 main() {
129 foo(new DateTime.now().millisecondsSinceEpoch); 129 foo(new DateTime.now().millisecondsSinceEpoch);
130 } 130 }
131 """; 131 """;
132 132
133 Future runTest(String test, checker) { 133 Future runTest(String test, checker) {
134 Uri uri = new Uri(scheme: 'source'); 134 Uri uri = new Uri(scheme: 'source');
135 var compiler = compilerFor(test, uri); 135 var compiler = compilerFor(test, uri);
136 136
137 checkTypeOf(String name, TypeMask type) { 137 checkTypeOf(String name, TypeMask type) {
138 var commonMasks = compiler.commonMasks; 138 var commonMasks = compiler.closedWorld.commonMasks;
139 var typesInferrer = compiler.globalInference.typesInferrer; 139 var typesInferrer = compiler.globalInference.typesInferrerInternal;
140 var element = findElement(compiler, name); 140 var element = findElement(compiler, name);
141 var mask = typesInferrer.getReturnTypeOfElement(element); 141 var mask = typesInferrer.getReturnTypeOfElement(element);
142 Expect.equals(type, simplify(mask, compiler)); 142 Expect.equals(type, simplify(mask, compiler));
143 } 143 }
144 144
145 return compiler.run(uri).then((_) { 145 return compiler.run(uri).then((_) {
146 checker(compiler.commonMasks, checkTypeOf); 146 checker(compiler.closedWorld.commonMasks, checkTypeOf);
147 }); 147 });
148 } 148 }
149 149
150 main() { 150 main() {
151 asyncTest(() async { 151 asyncTest(() async {
152 await runTest(TEST1, (t, c) => c("foo", t.stringType)); 152 await runTest(TEST1, (t, c) => c("foo", t.stringType));
153 await runTest(TEST2, (t, c) => c("foo", t.stringType.nullable())); 153 await runTest(TEST2, (t, c) => c("foo", t.stringType.nullable()));
154 await runTest(TEST3, (t, c) => c("foo", t.uint31Type.nullable())); 154 await runTest(TEST3, (t, c) => c("foo", t.uint31Type.nullable()));
155 await runTest(TEST4, (t, c) => c("foo", t.uint31Type)); 155 await runTest(TEST4, (t, c) => c("foo", t.uint31Type));
156 await runTest(TEST5, (t, c) => c("foo", t.uint31Type.nullable())); 156 await runTest(TEST5, (t, c) => c("foo", t.uint31Type.nullable()));
157 await runTest(TEST6, (t, c) => c("foo", t.uint31Type.nullable())); 157 await runTest(TEST6, (t, c) => c("foo", t.uint31Type.nullable()));
158 }); 158 });
159 } 159 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_inference8_test.dart ('k') | tests/compiler/dart2js/type_mask_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698