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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = await compileWithDill( | 128 Compiler compiler2 = await compileWithDill( |
129 entryPoint, const {}, [Flags.analyzeOnly, Flags.enableAssertMessage], | 129 entryPoint, const {}, [Flags.analyzeOnly, Flags.enableAssertMessage], |
130 printSteps: true); | 130 printSteps: true); |
131 | 131 |
132 KernelFrontEndStrategy frontEndStrategy = compiler2.frontEndStrategy; | 132 KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy; |
133 KernelToElementMap elementMap = frontEndStrategy.elementMap; | 133 KernelToElementMap elementMap = frontendStrategy.elementMap; |
134 | 134 |
135 Expect.isFalse(compiler2.compilationFailed); | 135 Expect.isFalse(compiler2.compilationFailed); |
136 | 136 |
137 KernelEquivalence equivalence = new KernelEquivalence(elementMap); | 137 KernelEquivalence equivalence = new KernelEquivalence(elementMap); |
138 | 138 |
139 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; | 139 ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution; |
140 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); | 140 ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld(); |
141 | 141 |
142 checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage, | 142 checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage, |
143 equivalence.defaultStrategy); | 143 equivalence.defaultStrategy); |
144 | 144 |
145 checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage, | 145 checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage, |
146 enqueuer1, enqueuer2, elementEquivalence: equivalence.entityEquivalence, | 146 enqueuer1, enqueuer2, elementEquivalence: equivalence.entityEquivalence, |
147 typeEquivalence: (ResolutionDartType a, DartType b) { | 147 typeEquivalence: (ResolutionDartType a, DartType b) { |
148 return equivalence.typeEquivalence(unalias(a), b); | 148 return equivalence.typeEquivalence(unalias(a), b); |
149 }, elementFilter: elementFilter, verbose: arguments.verbose); | 149 }, elementFilter: elementFilter, verbose: arguments.verbose); |
150 | 150 |
151 checkClosedWorlds(closedWorld1, closedWorld2, | 151 checkClosedWorlds(closedWorld1, closedWorld2, |
152 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); | 152 strategy: equivalence.defaultStrategy, verbose: arguments.verbose); |
153 | 153 |
154 return ResultKind.success; | 154 return ResultKind.success; |
155 } | 155 } |
OLD | NEW |