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