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