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

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

Issue 2043783002: Resynthesize enums lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6ded0164505e0b0c9a5fac75e23f0bc9d4ae9776..d757b807d8d9a2508749b107a1f7d7f7eee3a49c 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1006,9 +1006,9 @@ class _LibraryResynthesizer {
}
library.parts = partResynthesizers.map((r) => r.unit).toList();
// Populate units.
- populateUnit(definingUnitResynthesizer);
+ rememberUriToUnit(definingUnitResynthesizer);
for (_UnitResynthesizer partResynthesizer in partResynthesizers) {
- populateUnit(partResynthesizer);
+ rememberUriToUnit(partResynthesizer);
}
// Create the synthetic element for `loadLibrary`.
// Until the client received dart:core and dart:async, we cannot do this,
@@ -1089,13 +1089,12 @@ class _LibraryResynthesizer {
}
/**
- * Populate a [CompilationUnitElement] by deserializing all the elements
- * contained in it.
+ * Remember the absolute URI to the corresponding unit mapping.
*/
- void populateUnit(_UnitResynthesizer unitResynthesized) {
- unitResynthesized.populateUnit();
- String absoluteUri = unitResynthesized.unit.source.uri.toString();
- resynthesizedUnits[absoluteUri] = unitResynthesized.unit;
+ void rememberUriToUnit(_UnitResynthesizer unitResynthesized) {
+ CompilationUnitElementImpl unit = unitResynthesized.unit;
+ String absoluteUri = unit.source.uri.toString();
+ resynthesizedUnits[absoluteUri] = unit;
}
}
@@ -1423,13 +1422,6 @@ class _UnitResynthesizer {
CompilationUnitElementImpl unit;
/**
- * [ElementHolder] into which resynthesized elements should be placed. This
- * object is recreated afresh for each unit in the library, and is used to
- * populate the [CompilationUnitElement].
- */
- final ElementHolder unitHolder = new ElementHolder();
-
- /**
* Map from slot id to the corresponding [EntityRef] object for linked types
* (i.e. propagated and inferred types).
*/
@@ -1508,44 +1500,6 @@ class _UnitResynthesizer {
}
/**
- * Build the documentation for the given [element]. Does nothing if
- * [serializedDocumentationComment] is `null`.
- */
- void buildDocumentation(ElementImpl element,
- UnlinkedDocumentationComment serializedDocumentationComment) {
- if (serializedDocumentationComment != null) {
- element.documentationComment = serializedDocumentationComment.text;
- element.setDocRange(serializedDocumentationComment.offset,
- serializedDocumentationComment.length);
- }
- }
-
- /**
- * Resynthesize the [ClassElement] corresponding to an enum, along with the
- * associated fields and implicit accessors.
- */
- void buildEnum(UnlinkedEnum serializedEnum) {
- assert(!libraryResynthesizer.isCoreLibrary);
- EnumElementImpl classElement =
- new EnumElementImpl.forSerialized(serializedEnum, unit);
- unitHolder.addEnum(classElement);
- }
-
- /**
- * Build the implicit getter and setter associated with [element], and place
- * them in [holder].
- */
- void buildImplicitAccessors(
- PropertyInducingElementImpl element, ElementHolder holder) {
- PropertyAccessorElementImpl getter = buildImplicitGetter(element);
- holder?.addAccessor(getter);
- if (!(element.isConst || element.isFinal)) {
- PropertyAccessorElementImpl setter = buildImplicitSetter(element);
- holder?.addAccessor(setter);
- }
- }
-
- /**
* Build an implicit getter for the given [property] and bind it to the
* [property] and to its enclosing element.
*/
@@ -1813,15 +1767,6 @@ class _UnitResynthesizer {
return result;
}
- /**
- * Populate a [CompilationUnitElement] by deserializing all the elements
- * contained in it.
- */
- void populateUnit() {
- unlinkedUnit.enums.forEach(buildEnum);
- unit.enums = unitHolder.enums;
- }
-
Expression _buildConstExpression(ElementImpl context, UnlinkedConst uc) {
return new _ConstExprBuilder(this, context, uc).build();
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698