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

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

Issue 2030403002: Resynthesize constructors lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks 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 dc673e69a137b06d102bde2f151a5a8e2c2d067f..8dc8e78e33e17b3745cc76ae9cee4907cd63fd8c 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1483,6 +1483,11 @@ class _ResynthesizerContext implements ResynthesizerContext {
}
@override
+ bool isInConstCycle(int slot) {
+ return _unitResynthesizer.constCycles.contains(slot);
+ }
+
+ @override
ConstructorElement resolveConstructorRef(
TypeParameterizedElementMixin typeParameterContext, EntityRef entry) {
return _unitResynthesizer._getConstructorForEntry(
@@ -1701,36 +1706,20 @@ class _UnitResynthesizer {
for (UnlinkedVariable serializedVariable in serializedClass.fields) {
buildField(classElement, serializedVariable, memberHolder);
}
- bool constructorFound = false;
for (UnlinkedExecutable serializedExecutable
in serializedClass.executables) {
switch (serializedExecutable.kind) {
- case UnlinkedExecutableKind.constructor:
- constructorFound = true;
- buildConstructor(serializedExecutable, classElement, memberHolder);
- break;
case UnlinkedExecutableKind.getter:
case UnlinkedExecutableKind.setter:
buildClassExecutable(
serializedExecutable, classElement, memberHolder);
break;
+ case UnlinkedExecutableKind.constructor:
case UnlinkedExecutableKind.functionOrMethod:
// Resynthesized lazily.
break;
}
}
- if (!serializedClass.isMixinApplication) {
- if (!constructorFound) {
- // Synthesize implicit constructors.
- ConstructorElementImpl constructor = new ConstructorElementImpl('', -1);
- constructor.synthetic = true;
- constructor.returnType = classElement.type;
- constructor.type = new FunctionTypeImpl.elementWithNameAndArgs(
- constructor, null, classElement.type.typeArguments, false);
- memberHolder.addConstructor(constructor);
- }
- classElement.constructors = memberHolder.constructors;
- }
classElement.accessors = memberHolder.accessors;
classElement.fields = memberHolder.fields;
}
@@ -1759,20 +1748,6 @@ class _UnitResynthesizer {
}
/**
- * Resynthesize a [ConstructorElement] and place it in the given [holder].
- * [classElement] is the element of the class for which this element is a
- * constructor.
- */
- void buildConstructor(UnlinkedExecutable serializedExecutable,
- ClassElementImpl classElement, ElementHolder holder) {
- assert(serializedExecutable.kind == UnlinkedExecutableKind.constructor);
- ConstructorElementImpl constructor =
- new ConstructorElementImpl.forSerialized(
- serializedExecutable, constCycles, classElement);
- holder.addConstructor(constructor);
- }
-
- /**
* Build the documentation for the given [element]. Does nothing if
* [serializedDocumentationComment] is `null`.
*/
« 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