| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 memorySourceFiles = SOURCE; | 68 memorySourceFiles = SOURCE; |
| 69 } | 69 } |
| 70 | 70 |
| 71 asyncTest(() async { | 71 asyncTest(() async { |
| 72 enableDebugMode(); | 72 enableDebugMode(); |
| 73 Compiler compiler = compilerFor( | 73 Compiler compiler = compilerFor( |
| 74 entryPoint: entryPoint, | 74 entryPoint: entryPoint, |
| 75 memorySourceFiles: memorySourceFiles, | 75 memorySourceFiles: memorySourceFiles, |
| 76 options: [ | 76 options: [ |
| 77 Flags.analyzeOnly, | 77 Flags.analyzeOnly, |
| 78 Flags.useKernel, | 78 Flags.useKernelInSsa, |
| 79 Flags.enableAssertMessage | 79 Flags.enableAssertMessage |
| 80 ]); | 80 ]); |
| 81 ElementResolutionWorldBuilder.useInstantiationMap = true; | 81 ElementResolutionWorldBuilder.useInstantiationMap = true; |
| 82 compiler.resolution.retainCachesForTesting = true; | 82 compiler.resolution.retainCachesForTesting = true; |
| 83 await compiler.run(entryPoint); | 83 await compiler.run(entryPoint); |
| 84 compiler.resolutionWorldBuilder.closeWorld(); | 84 compiler.resolutionWorldBuilder.closeWorld(); |
| 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`. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 ClosedWorld computeClosedWorld(DiagnosticReporter reporter, | 171 ClosedWorld computeClosedWorld(DiagnosticReporter reporter, |
| 172 ResolutionEnqueuer enqueuer, ElementEnvironment elementEnvironment) { | 172 ResolutionEnqueuer enqueuer, ElementEnvironment elementEnvironment) { |
| 173 enqueuer.open(const ImpactStrategy(), elementEnvironment.mainFunction, | 173 enqueuer.open(const ImpactStrategy(), elementEnvironment.mainFunction, |
| 174 elementEnvironment.libraries); | 174 elementEnvironment.libraries); |
| 175 enqueuer.forEach((WorkItem work) { | 175 enqueuer.forEach((WorkItem work) { |
| 176 enqueuer.applyImpact(work.run(), impactSource: work.element); | 176 enqueuer.applyImpact(work.run(), impactSource: work.element); |
| 177 }); | 177 }); |
| 178 return enqueuer.worldBuilder.closeWorld(); | 178 return enqueuer.worldBuilder.closeWorld(); |
| 179 } | 179 } |
| OLD | NEW |