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

Unified Diff: pkg/front_end/tool/_fasta/analyzer_compile.dart

Issue 2828583003: remove dependencies to analyzer from lib/src/fasta (Closed)
Patch Set: rebase Created 3 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
Index: pkg/front_end/tool/_fasta/analyzer_compile.dart
diff --git a/pkg/front_end/tool/_fasta/analyzer_compile.dart b/pkg/front_end/tool/_fasta/analyzer_compile.dart
index 27f34da2f039b15ea034ff3da1ca386dda7dd176..8660520fee9240bf658ea9643a448ed01f002fc2 100644
--- a/pkg/front_end/tool/_fasta/analyzer_compile.dart
+++ b/pkg/front_end/tool/_fasta/analyzer_compile.dart
@@ -2,7 +2,65 @@
// 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.
-import 'package:front_end/src/fasta/analyzer/analyzer_compile.dart'
- show mainEntryPoint;
+library fasta.analyzer_compile;
-main(List<String> arguments) => mainEntryPoint(arguments);
+import 'dart:async' show Future;
+
+import 'dart:io' show exitCode;
+
+import 'package:analyzer/src/fasta/analyzer_target.dart' show AnalyzerTarget;
+
+import 'package:front_end/src/fasta/compiler_command_line.dart'
+ show CompilerCommandLine;
+
+import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
+
+import 'package:front_end/src/fasta/ticker.dart' show Ticker;
+
+import 'package:front_end/src/fasta/fasta.dart' show CompileTask;
+
+import 'package:front_end/src/fasta/errors.dart' show InputError;
+
+import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
+
+import 'package:front_end/src/fasta/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);
+
+ @override
+ AnalyzerTarget createKernelTarget(
+ DillTarget dillTarget, TranslateUri uriTranslator, bool strongMode) {
+ return new AnalyzerTarget(
+ dillTarget, uriTranslator, strongMode, 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 | « pkg/front_end/test/subpackage_relationships_test.dart ('k') | pkg/front_end/tool/_fasta/compile_platform_dartk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698