Index: pkg/analyzer/lib/src/dart/element/element.dart |
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart |
index d407317ca9a387796d8cb3b4fde008baedbf31a0..1d8e87e8121ef7866f114cea3a239da442ea951f 100644 |
--- a/pkg/analyzer/lib/src/dart/element/element.dart |
+++ b/pkg/analyzer/lib/src/dart/element/element.dart |
@@ -1682,6 +1682,9 @@ class ConstructorElementImpl extends ExecutableElementImpl |
ElementKind get kind => ElementKind.CONSTRUCTOR; |
@override |
+ DartType get returnType => enclosingElement.type; |
+ |
+ @override |
accept(ElementVisitor visitor) => visitor.visitConstructorElement(this); |
@override |
@@ -2806,7 +2809,7 @@ abstract class ExecutableElementImpl extends ElementImpl |
/** |
* The return type defined by this executable element. |
*/ |
- DartType returnType; |
+ DartType _returnType; |
/** |
* The type of function defined by this executable element. |
@@ -3040,6 +3043,26 @@ abstract class ExecutableElementImpl extends ElementImpl |
} |
@override |
+ DartType get returnType { |
+ if (serializedExecutable != null && _returnType == null) { |
+ bool isSetter = |
+ serializedExecutable.kind == UnlinkedExecutableKind.setter; |
+ _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType( |
+ serializedExecutable.inferredReturnTypeSlot, |
+ typeParameterContext) ?? |
+ enclosingUnit.resynthesizerContext.resolveTypeRef( |
+ serializedExecutable.returnType, typeParameterContext, |
+ defaultVoid: isSetter && context.analysisOptions.strongMode); |
+ } |
+ return _returnType; |
+ } |
+ |
+ void set returnType(DartType returnType) { |
+ assert(serializedExecutable == null); |
+ _returnType = returnType; |
+ } |
+ |
+ @override |
TypeParameterizedElementMixin get typeParameterContext => this; |
@override |
@@ -3631,7 +3654,7 @@ class FunctionTypeAliasElementImpl extends ElementImpl |
/** |
* The return type defined by this type alias. |
*/ |
- DartType returnType; |
+ DartType _returnType; |
/** |
* The type of function defined by this type alias. |
@@ -3762,6 +3785,20 @@ class FunctionTypeAliasElementImpl extends ElementImpl |
} |
@override |
+ DartType get returnType { |
+ if (_unlinkedTypedef != null && _returnType == null) { |
+ _returnType = enclosingUnit.resynthesizerContext |
+ .resolveTypeRef(_unlinkedTypedef.returnType, this); |
+ } |
+ return _returnType; |
+ } |
+ |
+ void set returnType(DartType returnType) { |
+ assert(_unlinkedTypedef == null); |
+ _returnType = returnType; |
+ } |
+ |
+ @override |
TypeParameterizedElementMixin get typeParameterContext => this; |
@override |