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 | 6 |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 import 'package:compiler/src/types/types.dart'; | 9 import 'package:compiler/src/types/types.dart'; |
10 import 'type_mask_test_helper.dart'; | 10 import 'type_mask_test_helper.dart'; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 checkReturn(MockCompiler compiler, String name, type) { | 166 checkReturn(MockCompiler compiler, String name, type) { |
167 var typesInferrer = compiler.typesTask.typesInferrer; | 167 var typesInferrer = compiler.typesTask.typesInferrer; |
168 var element = findElement(compiler, name); | 168 var element = findElement(compiler, name); |
169 Expect.equals( | 169 Expect.equals( |
170 type, | 170 type, |
171 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), | 171 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), |
172 name); | 172 name); |
173 } | 173 } |
174 | 174 |
175 var compiler1 = compilerFor(TEST1, uri); | 175 var compiler1 = compilerFor(TEST1, uri); |
176 asyncTest(() => compiler1.runCompiler(uri).then((_) { | 176 asyncTest(() => compiler1.run(uri).then((_) { |
177 checkReturn(compiler1, 'test1', compiler1.typesTask.uint31Type); | 177 checkReturn(compiler1, 'test1', compiler1.typesTask.uint31Type); |
178 checkReturn(compiler1, 'test2', | 178 checkReturn(compiler1, 'test2', |
179 compiler1.typesTask.dynamicType.nonNullable()); | 179 compiler1.typesTask.dynamicType.nonNullable()); |
180 checkReturn(compiler1, 'test3', compiler1.typesTask.uint31Type); | 180 checkReturn(compiler1, 'test3', compiler1.typesTask.uint31Type); |
181 checkReturn(compiler1, 'test4', compiler1.typesTask.mapType); | 181 checkReturn(compiler1, 'test4', compiler1.typesTask.mapType); |
182 checkReturn(compiler1, 'test5', | 182 checkReturn(compiler1, 'test5', |
183 compiler1.typesTask.dynamicType.nonNullable()); | 183 compiler1.typesTask.dynamicType.nonNullable()); |
184 checkReturn(compiler1, 'test6', | 184 checkReturn(compiler1, 'test6', |
185 compiler1.typesTask.dynamicType.nonNullable()); | 185 compiler1.typesTask.dynamicType.nonNullable()); |
186 })); | 186 })); |
187 | 187 |
188 var compiler2 = compilerFor(TEST2, uri); | 188 var compiler2 = compilerFor(TEST2, uri); |
189 asyncTest(() => compiler2.runCompiler(uri).then((_) { | 189 asyncTest(() => compiler2.run(uri).then((_) { |
190 checkReturn(compiler2, 'test1', compiler2.typesTask.mapType.nonNullable()); | 190 checkReturn(compiler2, 'test1', compiler2.typesTask.mapType.nonNullable()); |
191 checkReturn(compiler2, 'test2', compiler2.typesTask.mapType); | 191 checkReturn(compiler2, 'test2', compiler2.typesTask.mapType); |
192 checkReturn(compiler2, 'test3', compiler2.typesTask.mapType); | 192 checkReturn(compiler2, 'test3', compiler2.typesTask.mapType); |
193 checkReturn(compiler2, 'test4', compiler2.typesTask.mapType); | 193 checkReturn(compiler2, 'test4', compiler2.typesTask.mapType); |
194 checkReturn(compiler2, 'test5', compiler2.typesTask.mapType); | 194 checkReturn(compiler2, 'test5', compiler2.typesTask.mapType); |
195 | 195 |
196 checkReturn(compiler2, 'test6', compiler2.typesTask.numType); | 196 checkReturn(compiler2, 'test6', compiler2.typesTask.numType); |
197 checkReturn(compiler2, 'test7', compiler2.typesTask.uint31Type); | 197 checkReturn(compiler2, 'test7', compiler2.typesTask.uint31Type); |
198 checkReturn(compiler2, 'test8', compiler2.typesTask.uint31Type); | 198 checkReturn(compiler2, 'test8', compiler2.typesTask.uint31Type); |
199 checkReturn(compiler2, 'test9', compiler2.typesTask.uint31Type); | 199 checkReturn(compiler2, 'test9', compiler2.typesTask.uint31Type); |
200 checkReturn(compiler2, 'test10', compiler2.typesTask.numType); | 200 checkReturn(compiler2, 'test10', compiler2.typesTask.numType); |
201 checkReturn(compiler2, 'test11', compiler2.typesTask.doubleType); | 201 checkReturn(compiler2, 'test11', compiler2.typesTask.doubleType); |
202 })); | 202 })); |
203 | 203 |
204 var compiler3 = compilerFor(TEST3, uri); | 204 var compiler3 = compilerFor(TEST3, uri); |
205 asyncTest(() => compiler3.runCompiler(uri).then((_) { | 205 asyncTest(() => compiler3.run(uri).then((_) { |
206 checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty()); | 206 checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty()); |
207 checkReturn(compiler3, 'test2', compiler3.typesTask.mapType); | 207 checkReturn(compiler3, 'test2', compiler3.typesTask.mapType); |
208 checkReturn(compiler3, 'test3', compiler3.typesTask.mapType); | 208 checkReturn(compiler3, 'test3', compiler3.typesTask.mapType); |
209 checkReturn(compiler3, 'test4', compiler3.typesTask.mapType); | 209 checkReturn(compiler3, 'test4', compiler3.typesTask.mapType); |
210 checkReturn(compiler3, 'test5', compiler3.typesTask.mapType); | 210 checkReturn(compiler3, 'test5', compiler3.typesTask.mapType); |
211 checkReturn(compiler3, 'test6', compiler3.typesTask.mapType); | 211 checkReturn(compiler3, 'test6', compiler3.typesTask.mapType); |
212 })); | 212 })); |
213 | 213 |
214 var compiler4 = compilerFor(TEST4, uri); | 214 var compiler4 = compilerFor(TEST4, uri); |
215 asyncTest(() => compiler4.runCompiler(uri).then((_) { | 215 asyncTest(() => compiler4.run(uri).then((_) { |
216 checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty()); | 216 checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty()); |
217 checkReturn(compiler4, 'test2', compiler4.typesTask.mapType); | 217 checkReturn(compiler4, 'test2', compiler4.typesTask.mapType); |
218 checkReturn(compiler4, 'test3', compiler4.typesTask.mapType); | 218 checkReturn(compiler4, 'test3', compiler4.typesTask.mapType); |
219 checkReturn(compiler4, 'test4', compiler4.typesTask.mapType); | 219 checkReturn(compiler4, 'test4', compiler4.typesTask.mapType); |
220 checkReturn(compiler4, 'test5', compiler4.typesTask.mapType); | 220 checkReturn(compiler4, 'test5', compiler4.typesTask.mapType); |
221 checkReturn(compiler4, 'test6', compiler4.typesTask.mapType); | 221 checkReturn(compiler4, 'test6', compiler4.typesTask.mapType); |
222 })); | 222 })); |
223 } | 223 } |
OLD | NEW |