| 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 | 7 import 'dart:async' show |
| 8 Future; | 8 Future; |
| 9 | 9 |
| 10 import 'dart:io' show | 10 import 'dart:io' show |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 import 'ticker.dart' show | 32 import 'ticker.dart' show |
| 33 Ticker; | 33 Ticker; |
| 34 | 34 |
| 35 import 'translate_uri.dart' show | 35 import 'translate_uri.dart' show |
| 36 TranslateUri; | 36 TranslateUri; |
| 37 | 37 |
| 38 import 'ast_kind.dart' show | 38 import 'ast_kind.dart' show |
| 39 AstKind; | 39 AstKind; |
| 40 | 40 |
| 41 // TODO(ahe): Remove this import. Instead make the SDK available as resource in | |
| 42 // the executable, or something similar. | |
| 43 import 'testing/kernel_chain.dart' show | |
| 44 computePatchedSdk; | |
| 45 | |
| 46 Future<KernelTarget> outline(List<String> arguments) async { | 41 Future<KernelTarget> outline(List<String> arguments) async { |
| 47 try { | 42 try { |
| 48 return await CompilerCommandLine.withGlobalOptions( | 43 return await CompilerCommandLine.withGlobalOptions( |
| 49 "outline", arguments, (CompilerContext c) async { | 44 "outline", arguments, (CompilerContext c) async { |
| 50 if (c.options.verbose) { | 45 if (c.options.verbose) { |
| 51 print("Building outlines for ${arguments.join(' ')}"); | 46 print("Building outlines for ${arguments.join(' ')}"); |
| 52 } | 47 } |
| 53 return await doOutline(c, new Ticker(isVerbose: c.options.verbose), | 48 return await doOutline(c, new Ticker(isVerbose: c.options.verbose), |
| 54 c.options.output); | 49 c.options.output); |
| 55 }); | 50 }); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 }); | 84 }); |
| 90 } on InputError catch (e) { | 85 } on InputError catch (e) { |
| 91 exitCode = 1; | 86 exitCode = 1; |
| 92 print(e.format()); | 87 print(e.format()); |
| 93 return null; | 88 return null; |
| 94 } | 89 } |
| 95 } | 90 } |
| 96 | 91 |
| 97 Future<KernelTarget> doOutline(CompilerContext c, Ticker ticker, | 92 Future<KernelTarget> doOutline(CompilerContext c, Ticker ticker, |
| 98 [Uri output]) async { | 93 [Uri output]) async { |
| 99 Uri sdk = await computePatchedSdk(); | 94 TranslateUri uriTranslator = await TranslateUri.parse(c.options.sdk); |
| 100 ticker.logMs("Found patched SDK"); | |
| 101 TranslateUri uriTranslator = await TranslateUri.parse(sdk); | |
| 102 ticker.logMs("Read packages file"); | 95 ticker.logMs("Read packages file"); |
| 103 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 96 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); |
| 104 KernelTarget kernelTarget = | 97 KernelTarget kernelTarget = |
| 105 new KernelTarget(dillTarget, uriTranslator, c.uriToSource); | 98 new KernelTarget(dillTarget, uriTranslator, c.uriToSource); |
| 106 Uri platform = c.options.platform; | 99 Uri platform = c.options.platform; |
| 107 if (platform != null) { | 100 if (platform != null) { |
| 108 dillTarget.read(platform); | 101 dillTarget.read(platform); |
| 109 } | 102 } |
| 110 String argument = c.options.arguments.first; | 103 String argument = c.options.arguments.first; |
| 111 Uri uri = Uri.base.resolve(argument); | 104 Uri uri = Uri.base.resolve(argument); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 138 } catch (e, s) { | 131 } catch (e, s) { |
| 139 exitCode = 1; | 132 exitCode = 1; |
| 140 print("Verification of program failed: $e"); | 133 print("Verification of program failed: $e"); |
| 141 if (s != null && c.options.verbose) { | 134 if (s != null && c.options.verbose) { |
| 142 print(s); | 135 print(s); |
| 143 } | 136 } |
| 144 } | 137 } |
| 145 } | 138 } |
| 146 return uri; | 139 return uri; |
| 147 } | 140 } |
| OLD | NEW |