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 /// 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; | 6 library front_end.kernel_generator; |
7 | 7 |
8 import 'compiler_options.dart'; | 8 import 'compiler_options.dart'; |
9 import 'dart:async' show Future; | 9 import 'dart:async' show Future; |
10 import 'dart:async'; | 10 import 'dart:async'; |
11 import 'package:front_end/src/base/processed_options.dart'; | 11 import 'package:front_end/src/base/processed_options.dart'; |
12 import 'src/fasta/dill/dill_target.dart' show DillTarget; | 12 import 'src/fasta/dill/dill_target.dart' show DillTarget; |
13 import 'src/fasta/errors.dart' show InputError; | 13 import 'src/fasta/deprecated_problems.dart' show deprecated_InputError; |
14 import 'src/fasta/kernel/kernel_target.dart' show KernelTarget; | 14 import 'src/fasta/kernel/kernel_target.dart' show KernelTarget; |
15 import 'package:kernel/kernel.dart' show Program; | 15 import 'package:kernel/kernel.dart' show Program; |
16 import 'package:kernel/target/targets.dart' show TargetFlags; | 16 import 'package:kernel/target/targets.dart' show TargetFlags; |
17 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; | 17 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
18 import 'src/fasta/ticker.dart' show Ticker; | 18 import 'src/fasta/ticker.dart' show Ticker; |
19 import 'src/fasta/translate_uri.dart' show TranslateUri; | 19 import 'src/fasta/translate_uri.dart' show TranslateUri; |
20 import 'src/simple_error.dart'; | 20 import 'src/simple_error.dart'; |
21 | 21 |
22 /// Generates a kernel representation of the program whose main library is in | 22 /// Generates a kernel representation of the program whose main library is in |
23 /// the given [source]. | 23 /// the given [source]. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 if (program.mainMethod == null) { | 77 if (program.mainMethod == null) { |
78 return report("No 'main' method found."); | 78 return report("No 'main' method found."); |
79 } | 79 } |
80 | 80 |
81 if (!options.compileSdk) { | 81 if (!options.compileSdk) { |
82 // TODO(sigmund): ensure that the result is not including | 82 // TODO(sigmund): ensure that the result is not including |
83 // sources for the sdk, only external references. | 83 // sources for the sdk, only external references. |
84 } | 84 } |
85 return program; | 85 return program; |
86 } on InputError catch (e) { | 86 } on deprecated_InputError catch (e) { |
87 options.onError(new SimpleError(e.format())); | 87 options.onError(new SimpleError(e.deprecated_format())); |
88 return null; | 88 return null; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 /// Generates a kernel representation for a build unit. | 92 /// Generates a kernel representation for a build unit. |
93 /// | 93 /// |
94 /// Intended for modular compilation. | 94 /// Intended for modular compilation. |
95 /// | 95 /// |
96 /// The build unit by default contains only the source files in [sources] | 96 /// The build unit by default contains only the source files in [sources] |
97 /// (including library and part files), but if | 97 /// (including library and part files), but if |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 await kernelTarget.buildOutlines(); | 172 await kernelTarget.buildOutlines(); |
173 | 173 |
174 Program program = await kernelTarget.buildProgram(trimDependencies: true); | 174 Program program = await kernelTarget.buildProgram(trimDependencies: true); |
175 | 175 |
176 if (kernelTarget.errors.isNotEmpty) { | 176 if (kernelTarget.errors.isNotEmpty) { |
177 kernelTarget.errors.forEach(report); | 177 kernelTarget.errors.forEach(report); |
178 return null; | 178 return null; |
179 } | 179 } |
180 | 180 |
181 return program; | 181 return program; |
182 } on InputError catch (e) { | 182 } on deprecated_InputError catch (e) { |
183 options.onError(new SimpleError(e.format())); | 183 options.onError(new SimpleError(e.deprecated_format())); |
184 return null; | 184 return null; |
185 } | 185 } |
186 } | 186 } |
OLD | NEW |