| 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' show TypeMask; | 7 import 'package:compiler/src/types/types.dart' show TypeMask; |
| 8 | 8 |
| 9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
| 10 import 'type_mask_test_helper.dart'; | 10 import 'type_mask_test_helper.dart'; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 asyncTest(() => compiler.run(uri).then((_) { | 169 asyncTest(() => compiler.run(uri).then((_) { |
| 170 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 170 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
| 171 var closedWorld = typesInferrer.closedWorld; | 171 var closedWorld = typesInferrer.closedWorld; |
| 172 var commonMasks = closedWorld.commonMasks; | 172 var commonMasks = closedWorld.commonMasks; |
| 173 | 173 |
| 174 checkReturn(String name, type) { | 174 checkReturn(String name, type) { |
| 175 var element = findElement(compiler, name); | 175 var element = findElement(compiler, name); |
| 176 Expect.equals( | 176 Expect.equals( |
| 177 type, | 177 type, |
| 178 simplify( | 178 simplify( |
| 179 typesInferrer.getReturnTypeOfElement(element), closedWorld)); | 179 typesInferrer.getReturnTypeOfMember(element), closedWorld)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 checkReturn('returnInt1', commonMasks.uint31Type); | 182 checkReturn('returnInt1', commonMasks.uint31Type); |
| 183 checkReturn('returnInt2', commonMasks.uint31Type); | 183 checkReturn('returnInt2', commonMasks.uint31Type); |
| 184 checkReturn('returnInt3', commonMasks.uint31Type); | 184 checkReturn('returnInt3', commonMasks.uint31Type); |
| 185 checkReturn('returnInt4', commonMasks.uint31Type); | 185 checkReturn('returnInt4', commonMasks.uint31Type); |
| 186 checkReturn('returnInt5', commonMasks.uint31Type); | 186 checkReturn('returnInt5', commonMasks.uint31Type); |
| 187 checkReturn( | 187 checkReturn( |
| 188 'returnInt6', | 188 'returnInt6', |
| 189 new TypeMask.nonNullSubtype( | 189 new TypeMask.nonNullSubtype( |
| 190 closedWorld.commonElements.intClass, closedWorld)); | 190 closedWorld.commonElements.intClass, closedWorld)); |
| 191 | 191 |
| 192 var subclassOfInterceptor = commonMasks.interceptorType; | 192 var subclassOfInterceptor = commonMasks.interceptorType; |
| 193 | 193 |
| 194 checkReturn('returnDyn1', subclassOfInterceptor); | 194 checkReturn('returnDyn1', subclassOfInterceptor); |
| 195 checkReturn('returnDyn2', subclassOfInterceptor); | 195 checkReturn('returnDyn2', subclassOfInterceptor); |
| 196 checkReturn('returnDyn3', subclassOfInterceptor); | 196 checkReturn('returnDyn3', subclassOfInterceptor); |
| 197 checkReturn('returnDyn4', subclassOfInterceptor); | 197 checkReturn('returnDyn4', subclassOfInterceptor); |
| 198 checkReturn('returnDyn5', subclassOfInterceptor); | 198 checkReturn('returnDyn5', subclassOfInterceptor); |
| 199 checkReturn('returnDyn6', commonMasks.dynamicType); | 199 checkReturn('returnDyn6', commonMasks.dynamicType); |
| 200 })); | 200 })); |
| 201 } | 201 } |
| OLD | NEW |