| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:io' show | 5 import 'dart:io' show |
| 6 exit, | 6 exit, |
| 7 exitCode; | 7 exitCode; |
| 8 | 8 |
| 9 import 'package:front_end/src/fasta/ast_kind.dart' show | 9 import 'package:front_end/src/fasta/ast_kind.dart' show |
| 10 AstKind; | 10 AstKind; |
| 11 | 11 |
| 12 import 'package:front_end/src/fasta/compiler_command_line.dart' show | 12 import 'package:front_end/src/fasta/compiler_command_line.dart' show |
| 13 CompilerCommandLine; | 13 CompilerCommandLine; |
| 14 | 14 |
| 15 import 'package:front_end/src/fasta/compiler_context.dart' show |
| 16 CompilerContext; |
| 17 |
| 15 import 'package:front_end/src/fasta/outline.dart' show | 18 import 'package:front_end/src/fasta/outline.dart' show |
| 16 doCompile, | 19 doCompile; |
| 17 parseArguments; | |
| 18 | 20 |
| 19 import 'package:front_end/src/fasta/errors.dart' show | 21 import 'package:front_end/src/fasta/errors.dart' show |
| 20 InputError; | 22 InputError; |
| 21 | 23 |
| 22 import 'package:front_end/src/fasta/run.dart' show | 24 import 'package:front_end/src/fasta/run.dart' show |
| 23 run; | 25 run; |
| 24 | 26 |
| 25 import 'package:front_end/src/fasta/ticker.dart' show | 27 import 'package:front_end/src/fasta/ticker.dart' show |
| 26 Ticker; | 28 Ticker; |
| 27 | 29 |
| 28 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); | 30 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 29 | 31 |
| 30 main(List<String> arguments) async { | 32 main(List<String> arguments) async { |
| 31 Uri uri; | 33 Uri uri; |
| 32 CompilerCommandLine cl; | |
| 33 for (int i = 0; i < iterations; i++) { | 34 for (int i = 0; i < iterations; i++) { |
| 34 if (i > 0) { | 35 await CompilerCommandLine.withGlobalOptions( |
| 35 print("\n"); | 36 "run", arguments, (CompilerContext c) async { |
| 36 } | 37 if (i > 0) { |
| 37 try { | 38 print("\n"); |
| 38 cl = parseArguments("run", arguments); | 39 } |
| 39 uri = | 40 try { |
| 40 await doCompile(cl, new Ticker(isVerbose:cl.verbose), AstKind.Kernel); | 41 uri = await doCompile(c, new Ticker(isVerbose: c.options.verbose), |
| 41 } on InputError catch (e) { | 42 AstKind.Kernel); |
| 42 print(e.format()); | 43 } on InputError catch (e) { |
| 43 exit(1); | 44 print(e.format()); |
| 44 } | 45 exit(1); |
| 45 if (exitCode != 0) exit(exitCode); | 46 } |
| 47 if (exitCode != 0) exit(exitCode); |
| 48 if (i + 1 == iterations) { |
| 49 exit(await run(uri, c)); |
| 50 } |
| 51 }); |
| 46 } | 52 } |
| 47 exit(await run(uri, cl)); | |
| 48 } | 53 } |
| OLD | NEW |