| 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.compiler_helper; | 7 library dart2js.kernel.compiler_helper; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; | 174 Platform.environment['DART_CONFIGURATION'] ?? 'ReleaseX64'; |
| 175 await generate.main([ | 175 await generate.main([ |
| 176 '--platform=$buildDir/$configuration/patched_dart2js_sdk/platform.dill', | 176 '--platform=$buildDir/$configuration/patched_dart2js_sdk/platform.dill', |
| 177 '--out=${uriPathToNative(dillFile.path)}', | 177 '--out=${uriPathToNative(dillFile.path)}', |
| 178 '${entryPoint.path}', | 178 '${entryPoint.path}', |
| 179 ]); | 179 ]); |
| 180 return dillFile; | 180 return dillFile; |
| 181 } | 181 } |
| 182 | 182 |
| 183 Future<Compiler> compileWithDill( | 183 Future<Compiler> compileWithDill( |
| 184 Uri entryPoint, Map<String, String> memorySourceFiles, List<String> options, | 184 {Uri entryPoint, |
| 185 {bool printSteps: false, | 185 Map<String, String> memorySourceFiles: const <String, String>{}, |
| 186 List<String> options: const <String>[], |
| 187 CompilerDiagnostics diagnosticHandler, |
| 188 bool printSteps: false, |
| 186 CompilerOutput compilerOutput, | 189 CompilerOutput compilerOutput, |
| 187 void beforeRun(Compiler compiler)}) async { | 190 void beforeRun(Compiler compiler)}) async { |
| 188 Uri dillFile = | 191 Uri dillFile = |
| 189 await generateDill(entryPoint, memorySourceFiles, printSteps: printSteps); | 192 await generateDill(entryPoint, memorySourceFiles, printSteps: printSteps); |
| 190 | 193 |
| 191 if (printSteps) { | 194 if (printSteps) { |
| 192 print('---- compile from dill $dillFile ---------------------------------'); | 195 print('---- compile from dill $dillFile ---------------------------------'); |
| 193 } | 196 } |
| 194 Compiler compiler = compilerFor( | 197 Compiler compiler = compilerFor( |
| 195 entryPoint: dillFile, | 198 entryPoint: dillFile, |
| 196 options: [Flags.useKernel]..addAll(options), | 199 options: [Flags.useKernel]..addAll(options), |
| 200 diagnosticHandler: diagnosticHandler, |
| 197 outputProvider: compilerOutput); | 201 outputProvider: compilerOutput); |
| 198 ElementResolutionWorldBuilder.useInstantiationMap = true; | 202 ElementResolutionWorldBuilder.useInstantiationMap = true; |
| 199 compiler.resolution.retainCachesForTesting = true; | 203 compiler.resolution.retainCachesForTesting = true; |
| 200 if (beforeRun != null) { | 204 if (beforeRun != null) { |
| 201 beforeRun(compiler); | 205 beforeRun(compiler); |
| 202 } | 206 } |
| 203 await compiler.run(dillFile); | 207 await compiler.run(dillFile); |
| 204 return compiler; | 208 return compiler; |
| 205 } | 209 } |
| OLD | NEW |