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