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

Unified Diff: pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart

Issue 2723113002: Consolidate analyzer dependencies. (Closed)
Patch Set: Remove new dependency on AsyncMarker. Created 3 years, 10 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 | pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart b/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d348e70c68d7c87ceeb9b429edb6c876e6b82ce4
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/analyzer/analyzer_compile.dart
@@ -0,0 +1,63 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.analyzer_compile;
+
+import 'dart:async' show Future;
+
+import 'dart:io' show exitCode;
+
+import '../compiler_command_line.dart' show CompilerCommandLine;
+
+import '../compiler_context.dart' show CompilerContext;
+
+import '../ticker.dart' show Ticker;
+
+import '../outline.dart' show CompileTask;
+
+import '../errors.dart' show InputError;
+
+import 'analyzer_target.dart' show AnalyzerTarget;
+
+import '../dill/dill_target.dart' show DillTarget;
+
+import '../translate_uri.dart' show TranslateUri;
+
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
+
+Future<Uri> compile(List<String> arguments) async {
+ try {
+ return await CompilerCommandLine.withGlobalOptions("kompile", arguments,
+ (CompilerContext c) async {
+ if (c.options.verbose) {
+ print("Compiling via analyzer: ${arguments.join(' ')}");
+ }
+ AnalyzerCompileTask task =
+ new AnalyzerCompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ return await task.compile();
+ });
+ } on InputError catch (e) {
+ exitCode = 1;
+ print(e.format());
+ return null;
+ }
+}
+
+class AnalyzerCompileTask extends CompileTask {
+ AnalyzerCompileTask(CompilerContext c, Ticker ticker) : super(c, ticker);
+
+ AnalyzerTarget createKernelTarget(
+ DillTarget dillTarget, TranslateUri uriTranslator) {
+ return new AnalyzerTarget(dillTarget, uriTranslator, c.uriToSource);
+ }
+}
+
+main(List<String> arguments) async {
+ for (int i = 0; i < iterations; i++) {
+ if (i > 0) {
+ print("\n");
+ }
+ await compile(arguments);
+ }
+}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/analyzer/analyzer_diet_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698