mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
Use compiler context when serializing components and performing transformations.
Without this, if an error occurs during serialization you get this message: ``` Internal problem: Compiler cannot run without a compiler context. ``` Instead of the real error. Change-Id: I016ec0923a2e01b68f850988724be9d30179f78d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98740 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Auto-Submit: Jake Macdonald <jakemac@google.com>
This commit is contained in:
parent
523e3789e0
commit
edc6f88168
|
@ -258,14 +258,17 @@ Future<ComputeKernelResult> computeKernel(List<String> args,
|
|||
state.options.onDiagnostic = onDiagnostic;
|
||||
Component incrementalComponent = await state.incrementalCompiler
|
||||
.computeDelta(entryPoints: sources, fullComponent: true);
|
||||
if (summaryOnly) {
|
||||
incrementalComponent.uriToSource.clear();
|
||||
incrementalComponent.problemsAsJson = null;
|
||||
incrementalComponent.mainMethod = null;
|
||||
target.performOutlineTransformations(incrementalComponent);
|
||||
}
|
||||
|
||||
kernel = fe.serializeComponent(incrementalComponent);
|
||||
kernel = await state.incrementalCompiler.context.runInContext((_) {
|
||||
if (summaryOnly) {
|
||||
incrementalComponent.uriToSource.clear();
|
||||
incrementalComponent.problemsAsJson = null;
|
||||
incrementalComponent.mainMethod = null;
|
||||
target.performOutlineTransformations(incrementalComponent);
|
||||
}
|
||||
|
||||
return Future.value(fe.serializeComponent(incrementalComponent));
|
||||
});
|
||||
} else {
|
||||
kernel = await fe.compile(state, sources, onDiagnostic,
|
||||
summaryOnly: summaryOnly);
|
||||
|
|
Loading…
Reference in a new issue