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 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 dillTarget.loader.libraries.map((lib) => lib.importUri).toSet(); | 127 dillTarget.loader.libraries.map((lib) => lib.importUri).toSet(); |
128 trimProgram(program, (uri) => !excluded.contains(uri)); | 128 trimProgram(program, (uri) => !excluded.contains(uri)); |
129 } | 129 } |
130 if (options.debugDump) { | 130 if (options.debugDump) { |
131 printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary); | 131 printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary); |
132 } | 132 } |
133 options.ticker.logMs("Generated program"); | 133 options.ticker.logMs("Generated program"); |
134 } | 134 } |
135 | 135 |
136 if (kernelTarget.errors.isNotEmpty) { | 136 if (kernelTarget.errors.isNotEmpty) { |
137 // Note: we don't report errors here because they have been already | 137 // TODO(sigmund): remove duplicate error reporting. Currently |
138 // reported through the compiler context. | 138 // kernelTarget.errors contains recoverable and unrecoverable errors. We |
| 139 // are reporting unrecoverable errors twice. |
| 140 kernelTarget.errors.forEach((e) => options.report(e, Severity.error)); |
139 return null; | 141 return null; |
140 } | 142 } |
141 | 143 |
142 return new CompilerResult( | 144 return new CompilerResult( |
143 summary: summary, | 145 summary: summary, |
144 program: program, | 146 program: program, |
145 deps: kernelTarget.loader.getDependencies()); | 147 deps: kernelTarget.loader.getDependencies()); |
146 } on deprecated_InputError catch (e) { | 148 } on deprecated_InputError catch (e) { |
147 options.report( | 149 options.report( |
148 deprecated_InputError.toMessage(e), Severity.internalProblem); | 150 deprecated_InputError.toMessage(e), Severity.internalProblem); |
(...skipping 12 matching lines...) Expand all Loading... |
161 final Program program; | 163 final Program program; |
162 | 164 |
163 /// Dependencies traversed by the compiler. Used only for generating | 165 /// Dependencies traversed by the compiler. Used only for generating |
164 /// dependency .GN files in the dart-sdk build system. | 166 /// dependency .GN files in the dart-sdk build system. |
165 /// Note this might be removed when we switch to compute depencencies without | 167 /// Note this might be removed when we switch to compute depencencies without |
166 /// using the compiler itself. | 168 /// using the compiler itself. |
167 final List<Uri> deps; | 169 final List<Uri> deps; |
168 | 170 |
169 CompilerResult({this.summary, this.program, this.deps}); | 171 CompilerResult({this.summary, this.program, this.deps}); |
170 } | 172 } |
OLD | NEW |