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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart

Issue 2916533003: Set return type of factory constructors properly. (Closed)
Patch Set: Created 3 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/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index aa8719b0e614e4a9920b80e44279d588eb610438..bef02e6766a6a54c820d433c9a363f3284349f9a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -37,31 +37,10 @@ InterfaceType computeConstructorReturnType(Member constructor) {
if (constructor is Constructor) {
return constructor.enclosingClass.thisType;
} else {
- return computeFactoryConstructorReturnType(constructor);
+ return constructor.function.returnType;
ahe 2017/06/01 09:10:09 I also have to "steal" all these changes :-)
}
}
-/// Computes the return type of a factory constructor.
-///
-/// Note that we can't just use `constructor.function.functionType.returnType`,
-/// because that's `dynamic` for factory constructors. TODO(paulberry):
-/// investigate whether this can be changed.
-InterfaceType computeFactoryConstructorReturnType(Procedure constructor) {
- var returnType = constructor.enclosingClass.thisType;
- if (constructor.enclosingClass.typeParameters.isNotEmpty) {
- // target.enclosingClass.typeParameters is not the same as
- // target.function.functionType.typeParameters, so we have to substitute.
- returnType = Substitution
- .fromPairs(
- constructor.enclosingClass.typeParameters,
- constructor.function.functionType.typeParameters
- .map((p) => new TypeParameterType(p))
- .toList())
- .substituteType(returnType);
- }
- return returnType;
-}
-
List<DartType> getExplicitTypeArguments(Arguments arguments) {
if (arguments is KernelArguments) {
return arguments._hasExplicitTypeArguments ? arguments.types : null;

Powered by Google App Engine
This is Rietveld 408576698