| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 doTest('{presetKey : anInt}', "presetKey", "anInt"); | 207 doTest('{presetKey : anInt}', "presetKey", "anInt"); |
| 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.closedWorld; |
| 218 asyncTest(() => compiler.run(uri).then((_) { | 218 asyncTest(() => compiler.run(uri).then((_) { |
| 219 var keyType, valueType; | 219 var keyType, valueType; |
| 220 var commonMasks = compiler.commonMasks; | 220 var commonMasks = compiler.commonMasks; |
| 221 var typesInferrer = compiler.globalInference.typesInferrer; | 221 var typesInferrer = compiler.globalInference.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)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType), | 276 checkType('mapStoredInListButEscapes', K(commonMasks.dynamicType), |
| 277 V(commonMasks.dynamicType)); | 277 V(commonMasks.dynamicType)); |
| 278 checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type)); | 278 checkType('mapStoredInMap', K(aKeyType), V(commonMasks.uint31Type)); |
| 279 checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType), | 279 checkType('mapStoredInMapButEscapes', K(commonMasks.dynamicType), |
| 280 V(commonMasks.dynamicType)); | 280 V(commonMasks.dynamicType)); |
| 281 | 281 |
| 282 checkType('mapUnset', K(emptyType), V(emptyType)); | 282 checkType('mapUnset', K(emptyType), V(emptyType)); |
| 283 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); | 283 checkType('mapOnlySetWithConstraint', K(aKeyType), V(emptyType)); |
| 284 })); | 284 })); |
| 285 } | 285 } |
| OLD | NEW |