| 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 '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 const String TEST = """ | 10 const String TEST = """ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 """; | 115 """; |
| 116 | 116 |
| 117 void main() { | 117 void main() { |
| 118 Uri uri = new Uri(scheme: 'source'); | 118 Uri uri = new Uri(scheme: 'source'); |
| 119 var compiler = compilerFor(TEST, uri); | 119 var compiler = compilerFor(TEST, uri); |
| 120 asyncTest(() => compiler.run(uri).then((_) { | 120 asyncTest(() => compiler.run(uri).then((_) { |
| 121 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 121 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
| 122 var closedWorld = typesInferrer.closedWorld; | 122 var closedWorld = typesInferrer.closedWorld; |
| 123 | 123 |
| 124 checkReturn(String name, type) { | 124 checkReturn(String name, type) { |
| 125 var element = findElement(compiler, name); | 125 MemberElement element = findElement(compiler, name); |
| 126 Expect.equals( | 126 Expect.equals( |
| 127 type, | 127 type, |
| 128 simplify( | 128 simplify( |
| 129 typesInferrer.getReturnTypeOfMember(element), closedWorld), | 129 typesInferrer.getReturnTypeOfMember(element), closedWorld), |
| 130 name); | 130 name); |
| 131 } | 131 } |
| 132 | 132 |
| 133 checkReturn('returnInt1', closedWorld.commonMasks.uint31Type); | 133 checkReturn('returnInt1', closedWorld.commonMasks.uint31Type); |
| 134 checkReturn('returnInt2', closedWorld.commonMasks.uint31Type); | 134 checkReturn('returnInt2', closedWorld.commonMasks.uint31Type); |
| 135 checkReturn('returnInt3', closedWorld.commonMasks.uint31Type); | 135 checkReturn('returnInt3', closedWorld.commonMasks.uint31Type); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 152 type, | 152 type, |
| 153 simplify( | 153 simplify( |
| 154 typesInferrer.getReturnTypeOfMember(element), closedWorld)); | 154 typesInferrer.getReturnTypeOfMember(element), closedWorld)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 dynamic cls = findElement(compiler, 'A'); | 157 dynamic cls = findElement(compiler, 'A'); |
| 158 checkReturnInClass( | 158 checkReturnInClass( |
| 159 'A', 'foo', new TypeMask.nonNullExact(cls, closedWorld)); | 159 'A', 'foo', new TypeMask.nonNullExact(cls, closedWorld)); |
| 160 })); | 160 })); |
| 161 } | 161 } |
| OLD | NEW |