Macro. Reuse parsed unit when merging macro results.

This saves another 160 ms.

Bug: https://github.com/dart-lang/sdk/issues/55784
Change-Id: If626d616999b85edaaa4028cbe5fc70fbc1bf86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov 2024-06-24 18:16:39 +00:00 committed by Commit Queue
parent ef1ec76054
commit 08b50825c4

View file

@ -579,15 +579,11 @@ class LibraryBuilder with MacroApplicationsContainer {
var importedAugmentation = importState.importedAugmentation!;
var importedFile = importedAugmentation.file;
var unitNode = performance.run(
'importedFile.parse()',
(performance) {
performance.getDataInt('length').add(importedFile.content.length);
return importedFile.parse(
performance: performance,
);
},
var importedFileParsed = importedFile.getParsed(
performance: performance,
);
var unitNode = importedFileParsed.unit;
var unitElement = CompilationUnitElementImpl(
source: importedFile.source,
librarySource: importedFile.source,