OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 MapTypeMask, TypeMask; | 8 show MapTypeMask, TypeMask; |
9 | 9 |
10 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Test preset map of <Double,uint32> | 208 // Test preset map of <Double,uint32> |
209 doTest('{aDouble : anInt}', "aDouble", "anInt"); | 209 doTest('{aDouble : anInt}', "aDouble", "anInt"); |
210 } | 210 } |
211 | 211 |
212 void doTest(String allocation, [String keyElement, | 212 void doTest(String allocation, [String keyElement, |
213 String valueElement]) { | 213 String valueElement]) { |
214 Uri uri = new Uri(scheme: 'source'); | 214 Uri uri = new Uri(scheme: 'source'); |
215 var compiler = compilerFor(generateTest(allocation), uri, | 215 var compiler = compilerFor(generateTest(allocation), uri, |
216 expectedErrors: 0, expectedWarnings: 1); | 216 expectedErrors: 0, expectedWarnings: 1); |
217 var classWorld = compiler.world; | 217 var classWorld = compiler.world; |
218 asyncTest(() => compiler.runCompiler(uri).then((_) { | 218 asyncTest(() => compiler.run(uri).then((_) { |
219 var keyType, valueType; | 219 var keyType, valueType; |
220 var typesTask = compiler.typesTask; | 220 var typesTask = compiler.typesTask; |
221 var typesInferrer = typesTask.typesInferrer; | 221 var typesInferrer = typesTask.typesInferrer; |
222 var emptyType = new TypeMask.nonNullEmpty(); | 222 var emptyType = new TypeMask.nonNullEmpty(); |
223 var aKeyType = | 223 var aKeyType = |
224 typesInferrer.getTypeOfElement(findElement(compiler, 'aKey')); | 224 typesInferrer.getTypeOfElement(findElement(compiler, 'aKey')); |
225 if (keyElement != null) { | 225 if (keyElement != null) { |
226 keyType = | 226 keyType = |
227 typesInferrer.getTypeOfElement(findElement(compiler, keyElement)); | 227 typesInferrer.getTypeOfElement(findElement(compiler, keyElement)); |
228 } | 228 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 checkType('mapStoredInListButEscapes', K(typesTask.dynamicType), | 275 checkType('mapStoredInListButEscapes', K(typesTask.dynamicType), |
276 V(typesTask.dynamicType)); | 276 V(typesTask.dynamicType)); |
277 checkType('mapStoredInMap', K(aKeyType), V(typesTask.uint31Type)); | 277 checkType('mapStoredInMap', K(aKeyType), V(typesTask.uint31Type)); |
278 checkType('mapStoredInMapButEscapes', K(typesTask.dynamicType), | 278 checkType('mapStoredInMapButEscapes', K(typesTask.dynamicType), |
279 V(typesTask.dynamicType)); | 279 V(typesTask.dynamicType)); |
280 | 280 |
281 checkType('mapUnset', K(emptyType), V(emptyType)); | 281 checkType('mapUnset', K(emptyType), V(emptyType)); |
282 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); | 282 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); |
283 })); | 283 })); |
284 } | 284 } |
OLD | NEW |