OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/compiler.dart'; | 7 import 'package:compiler/src/compiler.dart'; |
8 import 'package:compiler/src/elements/elements.dart'; | 8 import 'package:compiler/src/elements/elements.dart'; |
9 import 'package:compiler/src/js_backend/js_backend.dart'; | 9 import 'package:compiler/src/js_backend/js_backend.dart'; |
10 import 'package:compiler/src/types/types.dart'; | 10 import 'package:compiler/src/types/types.dart'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 Expect.equals(expectNoInline, backend.annotations.noInline(method), | 85 Expect.equals(expectNoInline, backend.annotations.noInline(method), |
86 "Unexpected annotation of @NoInline on '$method'."); | 86 "Unexpected annotation of @NoInline on '$method'."); |
87 Expect.equals( | 87 Expect.equals( |
88 expectTrustTypeAnnotations, | 88 expectTrustTypeAnnotations, |
89 backend.annotations.trustTypeAnnotations(method), | 89 backend.annotations.trustTypeAnnotations(method), |
90 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); | 90 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); |
91 Expect.equals( | 91 Expect.equals( |
92 expectAssumeDynamic, | 92 expectAssumeDynamic, |
93 backend.annotations.assumeDynamic(method), | 93 backend.annotations.assumeDynamic(method), |
94 "Unexpected annotation of @AssumeDynamic on '$method'."); | 94 "Unexpected annotation of @AssumeDynamic on '$method'."); |
95 TypesInferrer inferrer = compiler.globalInference.typesInferrer; | 95 TypesInferrer inferrer = compiler.globalInference.typesInferrerInternal; |
96 if (expectTrustTypeAnnotations && expectedParameterType != null) { | 96 if (expectTrustTypeAnnotations && expectedParameterType != null) { |
97 testTypeMatch( | 97 testTypeMatch( |
98 method, expectedParameterType, expectedReturnType, inferrer); | 98 method, expectedParameterType, expectedReturnType, inferrer); |
99 } else if (expectAssumeDynamic) { | 99 } else if (expectAssumeDynamic) { |
100 testTypeMatch(method, compiler.commonMasks.dynamicType, null, inferrer); | 100 testTypeMatch(method, compiler.closedWorld.commonMasks.dynamicType, |
| 101 null, inferrer); |
101 } | 102 } |
102 } | 103 } |
103 | 104 |
104 TypeMask jsStringType = compiler.commonMasks.stringType; | 105 TypeMask jsStringType = compiler.closedWorld.commonMasks.stringType; |
105 TypeMask jsIntType = compiler.commonMasks.intType; | 106 TypeMask jsIntType = compiler.closedWorld.commonMasks.intType; |
106 TypeMask coreStringType = new TypeMask.subtype( | 107 TypeMask coreStringType = new TypeMask.subtype( |
107 compiler.coreClasses.stringClass, compiler.closedWorld); | 108 compiler.coreClasses.stringClass, compiler.closedWorld); |
108 | 109 |
109 test('method'); | 110 test('method'); |
110 test('methodAssumeDynamic', expectAssumeDynamic: true); | 111 test('methodAssumeDynamic', expectAssumeDynamic: true); |
111 test('methodTrustTypeAnnotations', | 112 test('methodTrustTypeAnnotations', |
112 expectTrustTypeAnnotations: true, expectedParameterType: jsStringType); | 113 expectTrustTypeAnnotations: true, expectedParameterType: jsStringType); |
113 test('methodNoInline', expectNoInline: true); | 114 test('methodNoInline', expectNoInline: true); |
114 test('methodNoInlineTrustTypeAnnotations', | 115 test('methodNoInlineTrustTypeAnnotations', |
115 expectNoInline: true, | 116 expectNoInline: true, |
116 expectTrustTypeAnnotations: true, | 117 expectTrustTypeAnnotations: true, |
117 expectedParameterType: jsStringType, | 118 expectedParameterType: jsStringType, |
118 expectedReturnType: jsIntType); | 119 expectedReturnType: jsIntType); |
119 test('methodAssumeDynamicTrustTypeAnnotations', | 120 test('methodAssumeDynamicTrustTypeAnnotations', |
120 expectAssumeDynamic: true, | 121 expectAssumeDynamic: true, |
121 expectTrustTypeAnnotations: true, | 122 expectTrustTypeAnnotations: true, |
122 expectedParameterType: coreStringType); | 123 expectedParameterType: coreStringType); |
123 }); | 124 }); |
124 } | 125 } |
OLD | NEW |