| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 dillTarget.loader.libraries.map((lib) => lib.importUri).toSet(); | 140 dillTarget.loader.libraries.map((lib) => lib.importUri).toSet(); |
| 141 trimProgram(program, (uri) => !excluded.contains(uri)); | 141 trimProgram(program, (uri) => !excluded.contains(uri)); |
| 142 } | 142 } |
| 143 if (options.debugDump) { | 143 if (options.debugDump) { |
| 144 printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary); | 144 printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary); |
| 145 } | 145 } |
| 146 options.ticker.logMs("Generated program"); | 146 options.ticker.logMs("Generated program"); |
| 147 } | 147 } |
| 148 | 148 |
| 149 if (kernelTarget.errors.isNotEmpty) { | 149 if (kernelTarget.errors.isNotEmpty) { |
| 150 kernelTarget.errors.forEach(options.deprecated_reportError); | 150 // TODO(ahe): The errors have already been reported via CompilerContext. |
| 151 kernelTarget.errors.forEach(options.reportMessage); |
| 151 return null; | 152 return null; |
| 152 } | 153 } |
| 153 | 154 |
| 154 return new CompilerResult( | 155 return new CompilerResult( |
| 155 summary: summary, | 156 summary: summary, |
| 156 program: program, | 157 program: program, |
| 157 deps: kernelTarget.loader.getDependencies()); | 158 deps: kernelTarget.loader.getDependencies()); |
| 158 } on deprecated_InputError catch (e) { | 159 } on deprecated_InputError catch (e) { |
| 159 options.deprecated_reportError(e.deprecated_format()); | 160 options.reportMessage(deprecated_InputError.toMessage(e)); |
| 160 return null; | 161 return null; |
| 161 } catch (e, t) { | 162 } catch (e, t) { |
| 162 return reportCrash(e, t); | 163 return reportCrash(e, t); |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 | 166 |
| 166 /// Result object of [generateKernel]. | 167 /// Result object of [generateKernel]. |
| 167 class CompilerResult { | 168 class CompilerResult { |
| 168 /// The generated summary bytes, if it was requested. | 169 /// The generated summary bytes, if it was requested. |
| 169 final List<int> summary; | 170 final List<int> summary; |
| 170 | 171 |
| 171 /// The generated program, if it was requested. | 172 /// The generated program, if it was requested. |
| 172 final Program program; | 173 final Program program; |
| 173 | 174 |
| 174 /// Dependencies traversed by the compiler. Used only for generating | 175 /// Dependencies traversed by the compiler. Used only for generating |
| 175 /// dependency .GN files in the dart-sdk build system. | 176 /// dependency .GN files in the dart-sdk build system. |
| 176 /// Note this might be removed when we switch to compute depencencies without | 177 /// Note this might be removed when we switch to compute depencencies without |
| 177 /// using the compiler itself. | 178 /// using the compiler itself. |
| 178 final List<Uri> deps; | 179 final List<Uri> deps; |
| 179 | 180 |
| 180 CompilerResult({this.summary, this.program, this.deps}); | 181 CompilerResult({this.summary, this.program, this.deps}); |
| 181 } | 182 } |
| OLD | NEW |