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

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

Issue 2874033003: Set MethodInvocation.interfaceTarget during type inference. (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 1512e67fe83730ef8ef8039d8eca11b4e9980805..945b5161c33bdfdec366b07feb7fea81b6639574 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
@@ -416,7 +416,8 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
/// provided. [forEachArgument] is a callback which can be used to iterate
/// through all invocation arguments (both named and positional).
/// [setInferredTypeArguments] is a callback which can be used to record the
- /// inferred type arguments.
+ /// inferred type arguments. [setInterfaceTarget] is a callback which can be
+ /// used to record the method being invoked.
DartType inferMethodInvocation(
DartType typeContext,
bool typeNeeded,
@@ -425,12 +426,14 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
Name methodName,
List<DartType> explicitTypeArguments,
void forEachArgument(void callback(String name, E expression)),
- void setInferredTypeArguments(List<DartType> types)) {
+ void setInferredTypeArguments(List<DartType> types),
+ void setInterfaceTarget(Procedure procedure)) {
// First infer the receiver so we can look up the method that was invoked.
var receiverType = inferExpression(receiver, null, true);
// TODO(paulberry): can we share some of the code below with
// inferConstructorInvocation?
- var memberFunctionType = _getCalleeFunctionType(receiverType, methodName);
+ var memberFunctionType = _getCalleeFunctionType(
+ receiverType, methodName, offset, setInterfaceTarget);
List<TypeParameter> memberTypeParameters =
memberFunctionType.typeParameters;
bool inferenceNeeded = explicitTypeArguments == null &&
@@ -583,13 +586,17 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> {
return inferExpression(value, declaredType, typeNeeded);
}
- FunctionType _getCalleeFunctionType(DartType receiverType, Name methodName) {
+ FunctionType _getCalleeFunctionType(DartType receiverType, Name methodName,
+ int offset, void setInterfaceTarget(Procedure procedure)) {
if (receiverType is InterfaceType) {
var member =
classHierarchy.getInterfaceMember(receiverType.classNode, methodName);
if (member == null) return _functionReturningDynamic;
var memberClass = member.enclosingClass;
if (member is Procedure) {
+ instrumentation?.record(Uri.parse(uri), offset, 'target',
+ new InstrumentationValueForProcedure(member));
+ setInterfaceTarget(member);
var memberFunctionType = member.function.functionType;
if (memberClass.typeParameters.isNotEmpty) {
var castedType = classHierarchy.getClassAsInstanceOf(
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart ('k') | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698