| 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 library fasta.outline; | 5 library fasta.outline; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show exitCode; | 9 import 'dart:io' show exitCode; |
| 10 | 10 |
| 11 import 'kernel/verifier.dart' show verifyProgram; | 11 import 'kernel/verifier.dart' show verifyProgram; |
| 12 | 12 |
| 13 import 'compiler_command_line.dart' show CompilerCommandLine; | 13 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 14 | 14 |
| 15 import 'compiler_context.dart' show CompilerContext; | 15 import 'compiler_context.dart' show CompilerContext; |
| 16 | 16 |
| 17 import 'errors.dart' show InputError, inputError; | 17 import 'errors.dart' show InputError, inputError; |
| 18 | 18 |
| 19 import 'kernel/kernel_target.dart' show KernelTarget; | 19 import 'kernel/kernel_target.dart' show KernelTarget; |
| 20 | 20 |
| 21 import 'dill/dill_target.dart' show DillTarget; | 21 import 'dill/dill_target.dart' show DillTarget; |
| 22 | 22 |
| 23 import 'ticker.dart' show Ticker; | 23 import 'ticker.dart' show Ticker; |
| 24 | 24 |
| 25 import 'translate_uri.dart' show TranslateUri; | 25 import 'translate_uri.dart' show TranslateUri; |
| 26 | 26 |
| 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 28 |
| 29 compileEntryPoint(List<String> arguments) async { |
| 30 for (int i = 0; i < iterations; i++) { |
| 31 if (i > 0) { |
| 32 print("\n"); |
| 33 } |
| 34 await compile(arguments); |
| 35 } |
| 36 } |
| 37 |
| 38 outlineEntryPoint(List<String> arguments) async { |
| 39 for (int i = 0; i < iterations; i++) { |
| 40 if (i > 0) { |
| 41 print("\n"); |
| 42 } |
| 43 await outline(arguments); |
| 44 } |
| 45 } |
| 46 |
| 27 Future<KernelTarget> outline(List<String> arguments) async { | 47 Future<KernelTarget> outline(List<String> arguments) async { |
| 28 try { | 48 try { |
| 29 return await CompilerCommandLine.withGlobalOptions("outline", arguments, | 49 return await CompilerCommandLine.withGlobalOptions("outline", arguments, |
| 30 (CompilerContext c) async { | 50 (CompilerContext c) async { |
| 31 if (c.options.verbose) { | 51 if (c.options.verbose) { |
| 32 print("Building outlines for ${arguments.join(' ')}"); | 52 print("Building outlines for ${arguments.join(' ')}"); |
| 33 } | 53 } |
| 34 CompileTask task = | 54 CompileTask task = |
| 35 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); | 55 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); |
| 36 return await task.buildOutline(c.options.output); | 56 return await task.buildOutline(c.options.output); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 exitCode = 1; | 132 exitCode = 1; |
| 113 print("Verification of program failed: $e"); | 133 print("Verification of program failed: $e"); |
| 114 if (s != null && c.options.verbose) { | 134 if (s != null && c.options.verbose) { |
| 115 print(s); | 135 print(s); |
| 116 } | 136 } |
| 117 } | 137 } |
| 118 } | 138 } |
| 119 return uri; | 139 return uri; |
| 120 } | 140 } |
| 121 } | 141 } |
| OLD | NEW |