| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 // Partial test that the closed world computed from [WorldImpact]s derived from | 5 // Partial test that the closed world computed from [WorldImpact]s derived from |
| 6 // kernel is equivalent to the original computed from resolution. | 6 // kernel is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.closed_world_from_dill_test; | 7 library dart2js.kernel.closed_world_from_dill_test; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return ResultKind.errors; | 118 return ResultKind.errors; |
| 119 } | 119 } |
| 120 if (collector.warnings.isNotEmpty && skipWarnings) { | 120 if (collector.warnings.isNotEmpty && skipWarnings) { |
| 121 print('Skipping due to warnings.'); | 121 print('Skipping due to warnings.'); |
| 122 return ResultKind.warnings; | 122 return ResultKind.warnings; |
| 123 } | 123 } |
| 124 Expect.isFalse(compiler1.compilationFailed); | 124 Expect.isFalse(compiler1.compilationFailed); |
| 125 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution; | 125 ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution; |
| 126 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld(); | 126 ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld(); |
| 127 | 127 |
| 128 Compiler compiler2 = | 128 Compiler compiler2 = await compileWithDill( |
| 129 await compileWithDill(entryPoint, const {}, printSteps: true); | 129 entryPoint, const {}, [Flags.analyzeOnly, Flags.enableAssertMessage], |
| 130 printSteps: true); |
| 130 | 131 |
| 131 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; | 132 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; |
| 132 KernelToElementMap elementMap = frontEndStrategy.elementMap; | 133 KernelToElementMap elementMap = frontEndStrategy.elementMap; |
| 133 | 134 |
| 134 Expect.isFalse(compiler2.compilationFailed); | 135 Expect.isFalse(compiler2.compilationFailed); |
| 135 | 136 |
| 136 KernelEquivalence equivalence = new KernelEquivalence(elementMap); | 137 KernelEquivalence equivalence = new KernelEquivalence(elementMap); |
| 137 | 138 |
| 138 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; | 139 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; |
| 139 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); | 140 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); |
| 140 | 141 |
| 141 checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage, | 142 checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage, |
| 142 equivalence.defaultStrategy); | 143 equivalence.defaultStrategy); |
| 143 | 144 |
| 144 checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage, | 145 checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage, |
| 145 enqueuer1, enqueuer2, elementEquivalence: equivalence.entityEquivalence, | 146 enqueuer1, enqueuer2, elementEquivalence: equivalence.entityEquivalence, |
| 146 typeEquivalence: (ResolutionDartType a, DartType b) { | 147 typeEquivalence: (ResolutionDartType a, DartType b) { |
| 147 return equivalence.typeEquivalence(unalias(a), b); | 148 return equivalence.typeEquivalence(unalias(a), b); |
| 148 }, elementFilter: elementFilter, verbose: arguments.verbose); | 149 }, elementFilter: elementFilter, verbose: arguments.verbose); |
| 149 | 150 |
| 150 checkClosedWorlds(closedWorld1, closedWorld2, | 151 checkClosedWorlds(closedWorld1, closedWorld2, |
| 151 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); | 152 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); |
| 152 | 153 |
| 153 return ResultKind.success; | 154 return ResultKind.success; |
| 154 } | 155 } |
| OLD | NEW |