| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // Tests that the closed world computed from [WorldImpact]s derived from kernel | 5 // Tests that the closed world computed from [WorldImpact]s derived from kernel |
| 6 // is equivalent to the original computed from resolution. | 6 // is equivalent to the original computed from resolution. |
| 7 library dart2js.kernel.closed_world_test; | 7 library dart2js.kernel.closed_world_test; |
| 8 | 8 |
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 JavaScriptBackend backend = compiler.backend; | 86 JavaScriptBackend backend = compiler.backend; |
| 87 // Create a new resolution enqueuer and feed it with the [WorldImpact]s | 87 // Create a new resolution enqueuer and feed it with the [WorldImpact]s |
| 88 // computed from kernel through the [build] in `kernel_impact.dart`. | 88 // computed from kernel through the [build] in `kernel_impact.dart`. |
| 89 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( | 89 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( |
| 90 compiler.enqueuer, | 90 compiler.enqueuer, |
| 91 compiler.options, | 91 compiler.options, |
| 92 compiler.reporter, | 92 compiler.reporter, |
| 93 const TreeShakingEnqueuerStrategy(), | 93 const TreeShakingEnqueuerStrategy(), |
| 94 backend.resolutionEnqueuerListener, | 94 backend.resolutionEnqueuerListener, |
| 95 backend.nativeResolutionEnqueuer(), | |
| 96 new ElementResolutionWorldBuilder( | 95 new ElementResolutionWorldBuilder( |
| 97 compiler.backend, compiler.resolution, const OpenWorldStrategy()), | 96 compiler.backend, compiler.resolution, const OpenWorldStrategy()), |
| 98 new ResolutionWorkItemBuilder(compiler.resolution), | 97 new ResolutionWorkItemBuilder(compiler.resolution), |
| 99 'enqueuer from kernel'); | 98 'enqueuer from kernel'); |
| 100 ClosedWorld closedWorld = computeClosedWorld(compiler, enqueuer); | 99 ClosedWorld closedWorld = computeClosedWorld(compiler, enqueuer); |
| 101 BackendUsage backendUsage = compiler.backend.backendUsageBuilder.close(); | 100 BackendUsage backendUsage = compiler.backend.backendUsageBuilder.close(); |
| 102 checkResolutionEnqueuers( | 101 checkResolutionEnqueuers( |
| 103 backendUsage, backendUsage, compiler.enqueuer.resolution, enqueuer, | 102 backendUsage, backendUsage, compiler.enqueuer.resolution, enqueuer, |
| 104 typeEquivalence: (ResolutionDartType a, ResolutionDartType b) { | 103 typeEquivalence: (ResolutionDartType a, ResolutionDartType b) { |
| 105 return areTypesEquivalent(unalias(a), unalias(b)); | 104 return areTypesEquivalent(unalias(a), unalias(b)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 compiler.libraryLoader.libraries); | 142 compiler.libraryLoader.libraries); |
| 144 enqueuer.forEach((work) { | 143 enqueuer.forEach((work) { |
| 145 AstElement element = work.element; | 144 AstElement element = work.element; |
| 146 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 145 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
| 147 WorldImpact worldImpact = compiler.backend.impactTransformer | 146 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 148 .transformResolutionImpact(enqueuer, resolutionImpact); | 147 .transformResolutionImpact(enqueuer, resolutionImpact); |
| 149 enqueuer.applyImpact(worldImpact, impactSource: element); | 148 enqueuer.applyImpact(worldImpact, impactSource: element); |
| 150 }); | 149 }); |
| 151 return enqueuer.worldBuilder.closeWorld(compiler.reporter); | 150 return enqueuer.worldBuilder.closeWorld(compiler.reporter); |
| 152 } | 151 } |
| OLD | NEW |