Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: lib/src/compiler/command.dart

Issue 1892553003: dont reuse the analysis context across worker requests (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: remove unused import Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/worker/hello_world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler/command.dart
diff --git a/lib/src/compiler/command.dart b/lib/src/compiler/command.dart
index fe83d8be0155223046252d35858ca4008a56e529..686dddfae493a29d3ccd42b1c32ad7b67e17ff43 100644
--- a/lib/src/compiler/command.dart
+++ b/lib/src/compiler/command.dart
@@ -4,7 +4,6 @@
import 'dart:convert' show JSON;
import 'dart:io';
-import 'package:args/args.dart';
import 'package:args/command_runner.dart';
import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:analyzer/src/summary/package_bundle_reader.dart'
@@ -32,13 +31,15 @@ class CompileCommand extends Command {
@override
void run() {
- var compiler =
- new ModuleCompiler(new AnalyzerOptions.fromArguments(argResults));
+ var analyzerOptions = new AnalyzerOptions.fromArguments(argResults);
if (argResults['persistent_worker']) {
- new _CompilerWorker(compiler, argParser, this, argResults.rest).run();
+ new _CompilerWorker(analyzerOptions, this).run();
} else {
- compile(compiler, new CompilerOptions.fromArguments(argResults),
- argResults['out'], argResults.rest);
+ compile(
+ new ModuleCompiler(analyzerOptions),
+ new CompilerOptions.fromArguments(argResults),
+ argResults['out'],
+ argResults.rest);
}
}
@@ -129,24 +130,23 @@ class CompileErrorException implements Exception {
/// Runs the compiler worker loop.
class _CompilerWorker extends SyncWorkerLoop {
- final ModuleCompiler compiler;
- final ArgParser argParser;
+ final AnalyzerOptions analyzerOptions;
final CompileCommand compileCommand;
- final List<String> extraArgs;
- _CompilerWorker(
- this.compiler, this.argParser, this.compileCommand, this.extraArgs)
- : super();
+ _CompilerWorker(this.analyzerOptions, this.compileCommand) : super();
WorkResponse performRequest(WorkRequest request) {
- var argResults = argParser.parse(request.arguments);
+ var arguments = new List.from(request.arguments)
+ ..addAll(compileCommand.argResults.rest);
+ var argResults = compileCommand.argParser.parse(arguments);
+
var output = new StringBuffer();
try {
compileCommand.compile(
- compiler,
+ new ModuleCompiler(analyzerOptions),
new CompilerOptions.fromArguments(argResults),
argResults['out'],
- new List.from(argResults.rest)..addAll(extraArgs),
+ argResults.rest,
forEachError: output.writeln);
return new WorkResponse()
..exitCode = EXIT_CODE_OK
« no previous file with comments | « no previous file | test/worker/hello_world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698