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

Unified Diff: pkg/front_end/lib/src/fasta/run.dart

Issue 2722223006: Move all main methods to tool/. (Closed)
Patch Set: Update tools/patch_sdk.dart. 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
Index: pkg/front_end/lib/src/fasta/run.dart
diff --git a/pkg/front_end/lib/src/fasta/run.dart b/pkg/front_end/lib/src/fasta/run.dart
index d7f812fe9232116afb5b2950892541ce63bc4f99..12041a2102a211b52d899f1fe81f1e14744aec15 100644
--- a/pkg/front_end/lib/src/fasta/run.dart
+++ b/pkg/front_end/lib/src/fasta/run.dart
@@ -6,7 +6,7 @@ library fasta.run;
import 'dart:async' show Future;
-import 'dart:io' show stdout;
+import 'dart:io' show stdout, exit, exitCode;
import 'package:testing/testing.dart' show StdioProcess;
@@ -14,6 +14,40 @@ import 'testing/kernel_chain.dart' show computeDartVm, computePatchedSdk;
import 'compiler_context.dart' show CompilerContext;
+import 'compiler_command_line.dart' show CompilerCommandLine;
+
+import 'outline.dart' show CompileTask;
+
+import 'errors.dart' show InputError;
+
+import 'ticker.dart' show Ticker;
+
+const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
+
+mainEntryPoint(List<String> arguments) async {
+ Uri uri;
+ for (int i = 0; i < iterations; i++) {
+ await CompilerCommandLine.withGlobalOptions("run", arguments,
+ (CompilerContext c) async {
+ if (i > 0) {
+ print("\n");
+ }
+ try {
+ CompileTask task =
+ new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
+ uri = await task.compile();
+ } on InputError catch (e) {
+ print(e.format());
+ exit(1);
+ }
+ if (exitCode != 0) exit(exitCode);
+ if (i + 1 == iterations) {
+ exit(await run(uri, c));
+ }
+ });
+ }
+}
+
Future<int> run(Uri uri, CompilerContext c) async {
Uri sdk = await computePatchedSdk();
Uri dartVm = computeDartVm(sdk);
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser_main.dart ('k') | pkg/front_end/lib/src/fasta/scanner/bin/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698