OLD | NEW |
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 | 7 |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 import 'type_mask_test_helper.dart'; | 9 import 'type_mask_test_helper.dart'; |
10 | 10 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 testStaticClosure1(); | 146 testStaticClosure1(); |
147 testStaticClosure2(); | 147 testStaticClosure2(); |
148 testStaticClosure3(); | 148 testStaticClosure3(); |
149 testStaticClosure4(); | 149 testStaticClosure4(); |
150 } | 150 } |
151 '''; | 151 '''; |
152 | 152 |
153 void main() { | 153 void main() { |
154 Uri uri = new Uri(scheme: 'source'); | 154 Uri uri = new Uri(scheme: 'source'); |
155 var compiler = compilerFor(TEST, uri); | 155 var compiler = compilerFor(TEST, uri); |
156 asyncTest(() => compiler.runCompiler(uri).then((_) { | 156 asyncTest(() => compiler.run(uri).then((_) { |
157 var typesTask = compiler.typesTask; | 157 var typesTask = compiler.typesTask; |
158 var typesInferrer = typesTask.typesInferrer; | 158 var typesInferrer = typesTask.typesInferrer; |
159 | 159 |
160 checkType(String name, type) { | 160 checkType(String name, type) { |
161 var element = findElement(compiler, name); | 161 var element = findElement(compiler, name); |
162 var mask = typesInferrer.getReturnTypeOfElement(element); | 162 var mask = typesInferrer.getReturnTypeOfElement(element); |
163 Expect.equals(type.nullable(), simplify(mask, compiler), name); | 163 Expect.equals(type.nullable(), simplify(mask, compiler), name); |
164 } | 164 } |
165 | 165 |
166 checkType('testFunctionStatement', typesTask.uint31Type); | 166 checkType('testFunctionStatement', typesTask.uint31Type); |
167 checkType('testFunctionExpression', typesTask.uint31Type); | 167 checkType('testFunctionExpression', typesTask.uint31Type); |
168 checkType('testStoredInInstance', typesTask.uint31Type); | 168 checkType('testStoredInInstance', typesTask.uint31Type); |
169 checkType('testStoredInStatic', typesTask.uint31Type); | 169 checkType('testStoredInStatic', typesTask.uint31Type); |
170 checkType('testStoredInMapOfList', typesTask.uint31Type); | 170 checkType('testStoredInMapOfList', typesTask.uint31Type); |
171 checkType('testStoredInListOfList', typesTask.uint31Type); | 171 checkType('testStoredInListOfList', typesTask.uint31Type); |
172 checkType('testStoredInListOfListUsingInsert', typesTask.uint31Type); | 172 checkType('testStoredInListOfListUsingInsert', typesTask.uint31Type); |
173 checkType('testStoredInListOfListUsingAdd', typesTask.uint31Type); | 173 checkType('testStoredInListOfListUsingAdd', typesTask.uint31Type); |
174 checkType('testPassedInParameter', typesTask.uint31Type); | 174 checkType('testPassedInParameter', typesTask.uint31Type); |
175 checkType('testStaticClosure1', typesTask.uint31Type); | 175 checkType('testStaticClosure1', typesTask.uint31Type); |
176 checkType('testStaticClosure2', typesTask.numType); | 176 checkType('testStaticClosure2', typesTask.numType); |
177 checkType('testStaticClosure3', typesTask.uint31Type); | 177 checkType('testStaticClosure3', typesTask.uint31Type); |
178 checkType('testStaticClosure4', typesTask.numType); | 178 checkType('testStaticClosure4', typesTask.numType); |
179 })); | 179 })); |
180 } | 180 } |
OLD | NEW |