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

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

Issue 2917853002: Compute correct return type for factory methods. (Closed)
Patch Set: Include changes from CL 2916533003. 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 21b0ecf8f1761ee2ce042e7c44c4f84cb8aacf8a..587fd496fcd17670c498fb1b70fa808dea8e82d3 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;
}
}
-/// 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