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 import 'package:compiler/src/types/types.dart' | 7 import 'package:compiler/src/types/types.dart' |
8 show TypeMask; | 8 show TypeMask; |
9 | 9 |
10 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 returnInt6(); | 161 returnInt6(); |
162 returnDyn6(); | 162 returnDyn6(); |
163 returnInt7(); | 163 returnInt7(); |
164 } | 164 } |
165 """; | 165 """; |
166 | 166 |
167 | 167 |
168 void main() { | 168 void main() { |
169 Uri uri = new Uri(scheme: 'source'); | 169 Uri uri = new Uri(scheme: 'source'); |
170 var compiler = compilerFor(TEST, uri); | 170 var compiler = compilerFor(TEST, uri); |
171 asyncTest(() => compiler.runCompiler(uri).then((_) { | 171 asyncTest(() => compiler.run(uri).then((_) { |
172 var typesTask = compiler.typesTask; | 172 var typesTask = compiler.typesTask; |
173 var typesInferrer = typesTask.typesInferrer; | 173 var typesInferrer = typesTask.typesInferrer; |
174 | 174 |
175 checkReturn(String name, type) { | 175 checkReturn(String name, type) { |
176 var element = findElement(compiler, name); | 176 var element = findElement(compiler, name); |
177 Expect.equals(type, | 177 Expect.equals(type, |
178 simplify(typesInferrer.getReturnTypeOfElement(element), compiler)); | 178 simplify(typesInferrer.getReturnTypeOfElement(element), compiler)); |
179 } | 179 } |
180 | 180 |
181 checkReturn('returnInt1', typesTask.uint31Type); | 181 checkReturn('returnInt1', typesTask.uint31Type); |
182 checkReturn('returnInt2', typesTask.uint31Type); | 182 checkReturn('returnInt2', typesTask.uint31Type); |
183 checkReturn('returnInt3', typesTask.uint31Type); | 183 checkReturn('returnInt3', typesTask.uint31Type); |
184 checkReturn('returnInt4', typesTask.uint31Type); | 184 checkReturn('returnInt4', typesTask.uint31Type); |
185 checkReturn('returnInt5', typesTask.uint31Type); | 185 checkReturn('returnInt5', typesTask.uint31Type); |
186 checkReturn('returnInt6', new TypeMask.nonNullSubtype( | 186 checkReturn('returnInt6', new TypeMask.nonNullSubtype( |
187 compiler.coreClasses.intClass, compiler.world)); | 187 compiler.coreClasses.intClass, compiler.world)); |
188 | 188 |
189 var subclassOfInterceptor = | 189 var subclassOfInterceptor = |
190 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); | 190 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
191 | 191 |
192 checkReturn('returnDyn1', subclassOfInterceptor); | 192 checkReturn('returnDyn1', subclassOfInterceptor); |
193 checkReturn('returnDyn2', subclassOfInterceptor); | 193 checkReturn('returnDyn2', subclassOfInterceptor); |
194 checkReturn('returnDyn3', subclassOfInterceptor); | 194 checkReturn('returnDyn3', subclassOfInterceptor); |
195 checkReturn('returnDyn4', subclassOfInterceptor); | 195 checkReturn('returnDyn4', subclassOfInterceptor); |
196 checkReturn('returnDyn5', subclassOfInterceptor); | 196 checkReturn('returnDyn5', subclassOfInterceptor); |
197 checkReturn('returnDyn6', typesTask.dynamicType); | 197 checkReturn('returnDyn6', typesTask.dynamicType); |
198 })); | 198 })); |
199 } | 199 } |
OLD | NEW |