| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 asyncTest(() async { | 70 asyncTest(() async { |
| 71 enableDebugMode(); | 71 enableDebugMode(); |
| 72 Compiler compiler = compilerFor( | 72 Compiler compiler = compilerFor( |
| 73 entryPoint: entryPoint, | 73 entryPoint: entryPoint, |
| 74 memorySourceFiles: memorySourceFiles, | 74 memorySourceFiles: memorySourceFiles, |
| 75 options: [ | 75 options: [ |
| 76 Flags.analyzeOnly, | 76 Flags.analyzeOnly, |
| 77 Flags.useKernel, | 77 Flags.useKernel, |
| 78 Flags.enableAssertMessage | 78 Flags.enableAssertMessage |
| 79 ]); | 79 ]); |
| 80 ElementResolutionWorldBuilder worldBuilder = | 80 ElementResolutionWorldBuilder.useInstantiationMap = true; |
| 81 compiler.enqueuer.resolution.worldBuilder; | |
| 82 worldBuilder.useInstantiationMap = true; | |
| 83 compiler.resolution.retainCachesForTesting = true; | 81 compiler.resolution.retainCachesForTesting = true; |
| 84 await compiler.run(entryPoint); | 82 await compiler.run(entryPoint); |
| 85 compiler.resolutionWorldBuilder.closeWorld(compiler.reporter); | 83 compiler.resolutionWorldBuilder.closeWorld(compiler.reporter); |
| 86 | 84 |
| 87 JavaScriptBackend backend = compiler.backend; | 85 JavaScriptBackend backend = compiler.backend; |
| 88 // Create a new resolution enqueuer and feed it with the [WorldImpact]s | 86 // Create a new resolution enqueuer and feed it with the [WorldImpact]s |
| 89 // computed from kernel through the [build] in `kernel_impact.dart`. | 87 // computed from kernel through the [build] in `kernel_impact.dart`. |
| 90 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( | 88 ResolutionEnqueuer enqueuer = new ResolutionEnqueuer( |
| 91 compiler.enqueuer, | 89 compiler.enqueuer, |
| 92 compiler.options, | 90 compiler.options, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 compiler.libraryLoader.libraries); | 156 compiler.libraryLoader.libraries); |
| 159 enqueuer.forEach((work) { | 157 enqueuer.forEach((work) { |
| 160 AstElement element = work.element; | 158 AstElement element = work.element; |
| 161 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); | 159 ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst); |
| 162 WorldImpact worldImpact = compiler.backend.impactTransformer | 160 WorldImpact worldImpact = compiler.backend.impactTransformer |
| 163 .transformResolutionImpact(enqueuer, resolutionImpact); | 161 .transformResolutionImpact(enqueuer, resolutionImpact); |
| 164 enqueuer.applyImpact(worldImpact, impactSource: element); | 162 enqueuer.applyImpact(worldImpact, impactSource: element); |
| 165 }); | 163 }); |
| 166 return enqueuer.worldBuilder.closeWorld(compiler.reporter); | 164 return enqueuer.worldBuilder.closeWorld(compiler.reporter); |
| 167 } | 165 } |
| OLD | NEW |