| 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' show MapTypeMask, TypeMask; | 7 import 'package:compiler/src/types/types.dart' show MapTypeMask, 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Test preset map of <String,uint32> | 204 // Test preset map of <String,uint32> |
| 205 doTest('{presetKey : anInt}', "presetKey", "anInt"); | 205 doTest('{presetKey : anInt}', "presetKey", "anInt"); |
| 206 // Test preset map of <Double,uint32> | 206 // Test preset map of <Double,uint32> |
| 207 doTest('{aDouble : anInt}', "aDouble", "anInt"); | 207 doTest('{aDouble : anInt}', "aDouble", "anInt"); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void doTest(String allocation, [String keyElement, String valueElement]) { | 210 void doTest(String allocation, [String keyElement, String valueElement]) { |
| 211 Uri uri = new Uri(scheme: 'source'); | 211 Uri uri = new Uri(scheme: 'source'); |
| 212 var compiler = compilerFor(generateTest(allocation), uri, | 212 var compiler = compilerFor(generateTest(allocation), uri, |
| 213 expectedErrors: 0, expectedWarnings: 1); | 213 expectedErrors: 0, expectedWarnings: 1); |
| 214 var classWorld = compiler.closedWorld; | 214 var classWorld = compiler.openWorld.closeWorld(); |
| 215 asyncTest(() => compiler.run(uri).then((_) { | 215 asyncTest(() => compiler.run(uri).then((_) { |
| 216 var keyType, valueType; | 216 var keyType, valueType; |
| 217 var commonMasks = compiler.commonMasks; | 217 var commonMasks = compiler.commonMasks; |
| 218 var typesInferrer = compiler.globalInference.typesInferrer; | 218 var typesInferrer = compiler.globalInference.typesInferrer; |
| 219 var emptyType = new TypeMask.nonNullEmpty(); | 219 var emptyType = new TypeMask.nonNullEmpty(); |
| 220 var aKeyType = | 220 var aKeyType = |
| 221 typesInferrer.getTypeOfElement(findElement(compiler, 'aKey')); | 221 typesInferrer.getTypeOfElement(findElement(compiler, 'aKey')); |
| 222 if (keyElement != null) { | 222 if (keyElement != null) { |
| 223 keyType = | 223 keyType = |
| 224 typesInferrer.getTypeOfElement(findElement(compiler, keyElement)); | 224 typesInferrer.getTypeOfElement(findElement(compiler, keyElement)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType), | 277 checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType), |
| 278 V(commonMasks.dynamicType)); | 278 V(commonMasks.dynamicType)); |
| 279 checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type)); | 279 checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type)); |
| 280 checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType), | 280 checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType), |
| 281 V(commonMasks.dynamicType)); | 281 V(commonMasks.dynamicType)); |
| 282 | 282 |
| 283 checkType('mapUnset', K(emptyType), V(emptyType)); | 283 checkType('mapUnset', K(emptyType), V(emptyType)); |
| 284 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); | 284 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); |
| 285 })); | 285 })); |
| 286 } | 286 } |
| OLD | NEW |