| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 /// Defines the front-end API for converting source code to Dart Kernel objects. | 5 /// Defines the front-end API for converting source code to Dart Kernel objects. |
| 6 library front_end.kernel_generator_impl; | 6 library front_end.kernel_generator_impl; |
| 7 | 7 |
| 8 import 'dart:async' show Future; | 8 import 'dart:async' show Future; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| 11 import 'package:kernel/kernel.dart' show Program, CanonicalName; | 11 import 'package:kernel/kernel.dart' show Program, CanonicalName; |
| 12 | 12 |
| 13 import 'base/processed_options.dart'; | 13 import 'base/processed_options.dart'; |
| 14 import 'fasta/dill/dill_target.dart' show DillTarget; | 14 import 'fasta/dill/dill_target.dart' show DillTarget; |
| 15 import 'fasta/errors.dart' show InputError, reportCrash; | 15 import 'fasta/deprecated_problems.dart' show deprecated_InputError, reportCrash; |
| 16 import 'fasta/kernel/kernel_outline_shaker.dart'; | 16 import 'fasta/kernel/kernel_outline_shaker.dart'; |
| 17 import 'fasta/kernel/kernel_target.dart' show KernelTarget; | 17 import 'fasta/kernel/kernel_target.dart' show KernelTarget; |
| 18 import 'fasta/kernel/verifier.dart'; | 18 import 'fasta/kernel/verifier.dart'; |
| 19 import 'fasta/kernel/utils.dart'; | 19 import 'fasta/kernel/utils.dart'; |
| 20 import 'fasta/compiler_command_line.dart'; | 20 import 'fasta/compiler_command_line.dart'; |
| 21 import 'fasta/translate_uri.dart' show TranslateUri; | 21 import 'fasta/translate_uri.dart' show TranslateUri; |
| 22 | 22 |
| 23 /// Implementation for the `package:front_end/kernel_generator.dart` and | 23 /// Implementation for the `package:front_end/kernel_generator.dart` and |
| 24 /// `package:front_end/summary_generator.dart` APIs. | 24 /// `package:front_end/summary_generator.dart` APIs. |
| 25 Future<CompilerResult> generateKernel(ProcessedOptions options, | 25 Future<CompilerResult> generateKernel(ProcessedOptions options, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 if (kernelTarget.errors.isNotEmpty) { | 139 if (kernelTarget.errors.isNotEmpty) { |
| 140 kernelTarget.errors.forEach(options.reportError); | 140 kernelTarget.errors.forEach(options.reportError); |
| 141 return null; | 141 return null; |
| 142 } | 142 } |
| 143 | 143 |
| 144 return new CompilerResult( | 144 return new CompilerResult( |
| 145 summary: summary, | 145 summary: summary, |
| 146 program: program, | 146 program: program, |
| 147 deps: kernelTarget.loader.getDependencies()); | 147 deps: kernelTarget.loader.getDependencies()); |
| 148 } on InputError catch (e) { | 148 } on deprecated_InputError catch (e) { |
| 149 options.reportError(e.format()); | 149 options.reportError(e.deprecated_format()); |
| 150 return null; | 150 return null; |
| 151 } catch (e, t) { | 151 } catch (e, t) { |
| 152 return reportCrash(e, t); | 152 return reportCrash(e, t); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 /// Result object of [generateKernel]. | 156 /// Result object of [generateKernel]. |
| 157 class CompilerResult { | 157 class CompilerResult { |
| 158 /// The generated summary bytes, if it was requested. | 158 /// The generated summary bytes, if it was requested. |
| 159 final List<int> summary; | 159 final List<int> summary; |
| 160 | 160 |
| 161 /// The generated program, if it was requested. | 161 /// The generated program, if it was requested. |
| 162 final Program program; | 162 final Program program; |
| 163 | 163 |
| 164 /// Dependencies traversed by the compiler. Used only for generating | 164 /// Dependencies traversed by the compiler. Used only for generating |
| 165 /// dependency .GN files in the dart-sdk build system. | 165 /// dependency .GN files in the dart-sdk build system. |
| 166 /// Note this might be removed when we switch to compute depencencies without | 166 /// Note this might be removed when we switch to compute depencencies without |
| 167 /// using the compiler itself. | 167 /// using the compiler itself. |
| 168 final List<Uri> deps; | 168 final List<Uri> deps; |
| 169 | 169 |
| 170 CompilerResult({this.summary, this.program, this.deps}); | 170 CompilerResult({this.summary, this.program, this.deps}); |
| 171 } | 171 } |
| OLD | NEW |