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 ContainerTypeMask, TypeMask; | 7 import 'package:compiler/src/types/types.dart' show ContainerTypeMask, TypeMask; |
8 | 8 |
9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 String value: "5.5", | 53 String value: "5.5", |
54 bool bail: false, | 54 bool bail: false, |
55 bool initial: false}) { | 55 bool initial: false}) { |
56 Uri uri = new Uri(scheme: 'source'); | 56 Uri uri = new Uri(scheme: 'source'); |
57 var compiler = compilerFor(generateTest(key, value, initial), uri, | 57 var compiler = compilerFor(generateTest(key, value, initial), uri, |
58 expectedErrors: 0, expectedWarnings: 0); | 58 expectedErrors: 0, expectedWarnings: 0); |
59 asyncTest(() => compiler.run(uri).then((_) { | 59 asyncTest(() => compiler.run(uri).then((_) { |
60 var typesInferrer = compiler.globalInference.typesInferrerInternal; | 60 var typesInferrer = compiler.globalInference.typesInferrerInternal; |
61 var commonMasks = typesInferrer.closedWorld.commonMasks; | 61 var commonMasks = typesInferrer.closedWorld.commonMasks; |
62 var aDoubleType = | 62 var aDoubleType = |
63 typesInferrer.getTypeOfElement(findElement(compiler, 'aDouble')); | 63 typesInferrer.getTypeOfMember(findElement(compiler, 'aDouble')); |
64 var aListType = | 64 var aListType = |
65 typesInferrer.getTypeOfElement(findElement(compiler, 'aList')); | 65 typesInferrer.getTypeOfMember(findElement(compiler, 'aList')); |
66 | 66 |
67 Expect.equals(aDoubleType, commonMasks.doubleType); | 67 Expect.equals(aDoubleType, commonMasks.doubleType); |
68 Expect.isTrue(aListType is ContainerTypeMask); | 68 Expect.isTrue(aListType is ContainerTypeMask); |
69 ContainerTypeMask container = aListType; | 69 ContainerTypeMask container = aListType; |
70 TypeMask elementType = container.elementType; | 70 TypeMask elementType = container.elementType; |
71 if (bail) { | 71 if (bail) { |
72 Expect.equals(elementType, commonMasks.dynamicType); | 72 Expect.equals(elementType, commonMasks.dynamicType); |
73 } else { | 73 } else { |
74 Expect.equals(elementType, commonMasks.uint31Type); | 74 Expect.equals(elementType, commonMasks.uint31Type); |
75 } | 75 } |
76 })); | 76 })); |
77 } | 77 } |
OLD | NEW |