| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |