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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 expectedReturnType, simplify(type, closedWorld), "$function"); | 76 expectedReturnType, simplify(type, closedWorld), "$function"); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void test(String name, | 80 void test(String name, |
81 {bool expectNoInline: false, | 81 {bool expectNoInline: false, |
82 bool expectTrustTypeAnnotations: false, | 82 bool expectTrustTypeAnnotations: false, |
83 TypeMask expectedParameterType: null, | 83 TypeMask expectedParameterType: null, |
84 TypeMask expectedReturnType: null, | 84 TypeMask expectedReturnType: null, |
85 bool expectAssumeDynamic: false}) { | 85 bool expectAssumeDynamic: false}) { |
86 LibraryElement mainApp = compiler.mainApp; | 86 LibraryElement mainApp = |
| 87 compiler.frontendStrategy.elementEnvironment.mainLibrary; |
87 MethodElement method = mainApp.find(name); | 88 MethodElement method = mainApp.find(name); |
88 Expect.isNotNull(method); | 89 Expect.isNotNull(method); |
89 Expect.equals(expectNoInline, backend.optimizerHints.noInline(method), | 90 Expect.equals(expectNoInline, backend.optimizerHints.noInline(method), |
90 "Unexpected annotation of @NoInline on '$method'."); | 91 "Unexpected annotation of @NoInline on '$method'."); |
91 Expect.equals( | 92 Expect.equals( |
92 expectTrustTypeAnnotations, | 93 expectTrustTypeAnnotations, |
93 backend.optimizerHints.trustTypeAnnotations(method), | 94 backend.optimizerHints.trustTypeAnnotations(method), |
94 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); | 95 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); |
95 Expect.equals( | 96 Expect.equals( |
96 expectAssumeDynamic, | 97 expectAssumeDynamic, |
(...skipping 23 matching lines...) Expand all Loading... |
120 expectNoInline: true, | 121 expectNoInline: true, |
121 expectTrustTypeAnnotations: true, | 122 expectTrustTypeAnnotations: true, |
122 expectedParameterType: jsStringType, | 123 expectedParameterType: jsStringType, |
123 expectedReturnType: jsIntType); | 124 expectedReturnType: jsIntType); |
124 test('methodAssumeDynamicTrustTypeAnnotations', | 125 test('methodAssumeDynamicTrustTypeAnnotations', |
125 expectAssumeDynamic: true, | 126 expectAssumeDynamic: true, |
126 expectTrustTypeAnnotations: true, | 127 expectTrustTypeAnnotations: true, |
127 expectedParameterType: coreStringType); | 128 expectedParameterType: coreStringType); |
128 }); | 129 }); |
129 } | 130 } |
OLD | NEW |