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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.run(uri).then((_) { | 156 asyncTest(() => compiler.run(uri).then((_) { |
157 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 157 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
158 var closedWorld = typesInferrer.closedWorld; | 158 var closedWorld = typesInferrer.closedWorld; |
159 var commonMasks = closedWorld.commonMasks; | 159 var commonMasks = closedWorld.commonMasks; |
160 | 160 |
161 checkType(String name, type) { | 161 checkType(String name, type) { |
162 var element = findElement(compiler, name); | 162 var element = findElement(compiler, name); |
163 var mask = typesInferrer.getReturnTypeOfElement(element); | 163 var mask = typesInferrer.getReturnTypeOfMember(element); |
164 Expect.equals(type.nullable(), simplify(mask, closedWorld), name); | 164 Expect.equals(type.nullable(), simplify(mask, closedWorld), name); |
165 } | 165 } |
166 | 166 |
167 checkType('testFunctionStatement', commonMasks.uint31Type); | 167 checkType('testFunctionStatement', commonMasks.uint31Type); |
168 checkType('testFunctionExpression', commonMasks.uint31Type); | 168 checkType('testFunctionExpression', commonMasks.uint31Type); |
169 checkType('testStoredInInstance', commonMasks.uint31Type); | 169 checkType('testStoredInInstance', commonMasks.uint31Type); |
170 checkType('testStoredInStatic', commonMasks.uint31Type); | 170 checkType('testStoredInStatic', commonMasks.uint31Type); |
171 checkType('testStoredInMapOfList', commonMasks.uint31Type); | 171 checkType('testStoredInMapOfList', commonMasks.uint31Type); |
172 checkType('testStoredInListOfList', commonMasks.uint31Type); | 172 checkType('testStoredInListOfList', commonMasks.uint31Type); |
173 checkType('testStoredInListOfListUsingInsert', commonMasks.uint31Type); | 173 checkType('testStoredInListOfListUsingInsert', commonMasks.uint31Type); |
174 checkType('testStoredInListOfListUsingAdd', commonMasks.uint31Type); | 174 checkType('testStoredInListOfListUsingAdd', commonMasks.uint31Type); |
175 checkType('testPassedInParameter', commonMasks.uint31Type); | 175 checkType('testPassedInParameter', commonMasks.uint31Type); |
176 checkType('testStaticClosure1', commonMasks.uint31Type); | 176 checkType('testStaticClosure1', commonMasks.uint31Type); |
177 checkType('testStaticClosure2', commonMasks.numType); | 177 checkType('testStaticClosure2', commonMasks.numType); |
178 checkType('testStaticClosure3', commonMasks.uint31Type); | 178 checkType('testStaticClosure3', commonMasks.uint31Type); |
179 checkType('testStaticClosure4', commonMasks.numType); | 179 checkType('testStaticClosure4', commonMasks.numType); |
180 })); | 180 })); |
181 } | 181 } |
OLD | NEW |