| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = compiler.mainApp; |
| 87 Element method = mainApp.find(name); | 87 MethodElement method = mainApp.find(name); |
| 88 Expect.isNotNull(method); | 88 Expect.isNotNull(method); |
| 89 Expect.equals(expectNoInline, backend.annotations.noInline(method), | 89 Expect.equals(expectNoInline, backend.optimizerHints.noInline(method), |
| 90 "Unexpected annotation of @NoInline on '$method'."); | 90 "Unexpected annotation of @NoInline on '$method'."); |
| 91 Expect.equals( | 91 Expect.equals( |
| 92 expectTrustTypeAnnotations, | 92 expectTrustTypeAnnotations, |
| 93 backend.annotations.trustTypeAnnotations(method), | 93 backend.optimizerHints.trustTypeAnnotations(method), |
| 94 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); | 94 "Unexpected annotation of @TrustTypeAnnotations on '$method'."); |
| 95 Expect.equals( | 95 Expect.equals( |
| 96 expectAssumeDynamic, | 96 expectAssumeDynamic, |
| 97 backend.annotations.assumeDynamic(method), | 97 backend.optimizerHints.assumeDynamic(method), |
| 98 "Unexpected annotation of @AssumeDynamic on '$method'."); | 98 "Unexpected annotation of @AssumeDynamic on '$method'."); |
| 99 TypesInferrer inferrer = compiler.globalInference.typesInferrerInternal; | 99 TypesInferrer inferrer = compiler.globalInference.typesInferrerInternal; |
| 100 if (expectTrustTypeAnnotations && expectedParameterType != null) { | 100 if (expectTrustTypeAnnotations && expectedParameterType != null) { |
| 101 testTypeMatch( | 101 testTypeMatch( |
| 102 method, expectedParameterType, expectedReturnType, inferrer); | 102 method, expectedParameterType, expectedReturnType, inferrer); |
| 103 } else if (expectAssumeDynamic) { | 103 } else if (expectAssumeDynamic) { |
| 104 testTypeMatch( | 104 testTypeMatch( |
| 105 method, closedWorld.commonMasks.dynamicType, null, inferrer); | 105 method, closedWorld.commonMasks.dynamicType, null, inferrer); |
| 106 } | 106 } |
| 107 } | 107 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 120 expectNoInline: true, | 120 expectNoInline: true, |
| 121 expectTrustTypeAnnotations: true, | 121 expectTrustTypeAnnotations: true, |
| 122 expectedParameterType: jsStringType, | 122 expectedParameterType: jsStringType, |
| 123 expectedReturnType: jsIntType); | 123 expectedReturnType: jsIntType); |
| 124 test('methodAssumeDynamicTrustTypeAnnotations', | 124 test('methodAssumeDynamicTrustTypeAnnotations', |
| 125 expectAssumeDynamic: true, | 125 expectAssumeDynamic: true, |
| 126 expectTrustTypeAnnotations: true, | 126 expectTrustTypeAnnotations: true, |
| 127 expectedParameterType: coreStringType); | 127 expectedParameterType: coreStringType); |
| 128 }); | 128 }); |
| 129 } | 129 } |
| OLD | NEW |