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:
Jacob MacDonald 2019-04-10 06:26:33 +00:00 committed by commit-bot@chromium.org
parent 523e3789e0
commit edc6f88168

View file

@ -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);