Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2001903002: Make imports resynthesizing completely lazy. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 34f71c08ba8a711fc093c7355182545249b4b839..da7c5f2d7f81762af8276541f0c87eb3a53c2bbd 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1089,19 +1089,9 @@ class _LibraryResynthesizer {
*/
NamespaceCombinator buildCombinator(UnlinkedCombinator serializedCombinator) {
if (serializedCombinator.shows.isNotEmpty) {
- ShowElementCombinatorImpl combinator = new ShowElementCombinatorImpl();
- // Note: we call toList() so that we don't retain a reference to the
- // deserialized data structure.
- combinator.shownNames = serializedCombinator.shows.toList();
- combinator.offset = serializedCombinator.offset;
- combinator.end = serializedCombinator.end;
- return combinator;
+ return new ShowElementCombinatorImpl.forSerialized(serializedCombinator);
} else {
- HideElementCombinatorImpl combinator = new HideElementCombinatorImpl();
- // Note: we call toList() so that we don't retain a reference to the
- // deserialized data structure.
- combinator.hiddenNames = serializedCombinator.hides.toList();
- return combinator;
+ return new HideElementCombinatorImpl.forSerialized(serializedCombinator);
}
}
@@ -1188,21 +1178,6 @@ class _LibraryResynthesizer {
}
/**
- * Resynthesize an [ImportElement].
- */
- ImportElement buildImport(
- _UnitResynthesizer definingUnitResynthesizer,
- UnlinkedImport serializedImport,
- int dependency,
- LibraryElement libraryBeingResynthesized) {
- ImportElementImpl importElement = new ImportElementImpl.forSerialized(
- serializedImport, dependency, library);
- importElement.combinators =
- serializedImport.combinators.map(buildCombinator).toList();
- return importElement;
- }
-
- /**
* Main entry point. Resynthesize the [LibraryElement] and return it.
*/
LibraryElement buildLibrary() {
@@ -1236,16 +1211,6 @@ class _LibraryResynthesizer {
partResynthesizers.add(partResynthesizer);
}
library.parts = partResynthesizers.map((r) => r.unit).toList();
- // Create imports.
- List<ImportElement> imports = <ImportElement>[];
- for (int i = 0; i < unlinkedDefiningUnit.imports.length; i++) {
- imports.add(buildImport(
- definingUnitResynthesizer,
- unlinkedDefiningUnit.imports[i],
- linkedLibrary.importDependencies[i],
- library));
- }
- library.imports = imports;
// Create exports.
List<ExportElement> exports = <ExportElement>[];
assert(unlinkedDefiningUnit.exports.length ==
@@ -1368,6 +1333,9 @@ class _LibraryResynthesizerContext implements LibraryResynthesizerContext {
_LibraryResynthesizerContext(this.resynthesizer);
@override
+ LinkedLibrary get linkedLibrary => resynthesizer.linkedLibrary;
+
+ @override
Namespace buildExportNamespace() {
LibraryElementImpl library = resynthesizer.library;
return resynthesizer.buildExportNamespace(

Powered by Google App Engine
This is Rietveld 408576698