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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart

Issue 2905163002: Perform type inference on redirecting initializers (`C() : this(...);`). (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/type_inference/type_inferrer.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 12bca4c8b868d10da639f6f28cec80a1279d3d11..0539e2cb8b59551f33d2de7b89455121b8ca043b 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -21,6 +21,7 @@ import 'package:kernel/ast.dart'
Expression,
Field,
FunctionType,
+ Initializer,
InterfaceType,
Member,
Name,
@@ -155,6 +156,9 @@ abstract class TypeInferrer {
/// Performs type inference on the given function body.
void inferFunctionBody(
DartType returnType, AsyncMarker asyncMarker, Statement body);
+
+ /// Performs type inference on the given constructor initializer.
+ void inferInitializer(Initializer initializer);
}
/// Derived class containing generic implementations of [TypeInferrer].
@@ -330,10 +334,13 @@ abstract class TypeInferrerImpl extends TypeInferrer {
/// invocations (constructors, instance methods, and static methods).
DartType inferInvocation(DartType typeContext, bool typeNeeded, int offset,
FunctionType calleeType, DartType returnType, Arguments arguments,
- {bool isOverloadedArithmeticOperator: false, DartType receiverType}) {
+ {bool isOverloadedArithmeticOperator: false,
+ DartType receiverType,
+ bool skipTypeArgumentInference: false}) {
var calleeTypeParameters = calleeType.typeParameters;
List<DartType> explicitTypeArguments = getExplicitTypeArguments(arguments);
- bool inferenceNeeded = explicitTypeArguments == null &&
+ bool inferenceNeeded = !skipTypeArgumentInference &&
+ explicitTypeArguments == null &&
strongMode &&
calleeTypeParameters.isNotEmpty;
List<DartType> inferredTypes;
« no previous file with comments | « pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart ('k') | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698