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

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

Issue 1565643002: Eliminate constructor return types from summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 e83b6619d47a447cf9a055e6cf0bf8470da9669a..a0d0fbf0fb815aa09a058c24351769c8c6f3b8f9 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -246,7 +246,8 @@ class _LibraryResynthesizer {
switch (serializedExecutable.kind) {
case UnlinkedExecutableKind.constructor:
constructorFound = true;
- buildConstructor(serializedExecutable, memberHolder);
+ buildConstructor(
+ serializedExecutable, memberHolder, correspondingType);
break;
case UnlinkedExecutableKind.functionOrMethod:
case UnlinkedExecutableKind.getter:
@@ -308,12 +309,15 @@ class _LibraryResynthesizer {
/**
* Resynthesize a [ConstructorElement] and place it in the given [holder].
+ * [classType] is the type of the class for which this element is a
+ * constructor.
*/
- void buildConstructor(
- UnlinkedExecutable serializedExecutable, ElementHolder holder) {
+ void buildConstructor(UnlinkedExecutable serializedExecutable,
+ ElementHolder holder, InterfaceType classType) {
assert(serializedExecutable.kind == UnlinkedExecutableKind.constructor);
ConstructorElementImpl constructorElement =
new ConstructorElementImpl(serializedExecutable.name, -1);
+ constructorElement.returnType = classType;
buildExecutableCommonParts(constructorElement, serializedExecutable);
constructorElement.factory = serializedExecutable.isFactory;
constructorElement.const2 = serializedExecutable.isConst;
@@ -449,6 +453,9 @@ class _LibraryResynthesizer {
serializedExecutable.parameters.map(buildParameter).toList();
if (serializedExecutable.returnType != null) {
executableElement.returnType = buildType(serializedExecutable.returnType);
+ } else if (serializedExecutable.kind ==
+ UnlinkedExecutableKind.constructor) {
+ // Return type was set by the caller.
} else {
executableElement.returnType = VoidTypeImpl.instance;
}

Powered by Google App Engine
This is Rietveld 408576698