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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2923653003: Change MethodInvocation.interfaceTarget from a Procedure to a Member. (Closed)
Patch Set: Update after https://codereview.chromium.org/2920223008/ Created 3 years, 6 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/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index bcfae72741e3639c107f73b1187437b65eb1abcd..549c063b09f9ef34af401f262e8268ec583dd04d 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -2132,7 +2132,7 @@ class MethodInvocation extends InvocationExpression {
Reference interfaceTargetReference;
MethodInvocation(Expression receiver, Name name, Arguments arguments,
- [Procedure interfaceTarget])
+ [Member interfaceTarget])
: this.byReference(
receiver, name, arguments, getMemberReference(interfaceTarget));
@@ -2142,27 +2142,33 @@ class MethodInvocation extends InvocationExpression {
arguments?.parent = this;
}
- Procedure get interfaceTarget => interfaceTargetReference?.asProcedure;
+ Member get interfaceTarget => interfaceTargetReference?.asMember;
void set interfaceTarget(Member target) {
interfaceTargetReference = getMemberReference(target);
}
DartType getStaticType(TypeEnvironment types) {
+ var interfaceTarget = this.interfaceTarget;
if (interfaceTarget != null) {
- if (types.isOverloadedArithmeticOperator(interfaceTarget)) {
+ if (interfaceTarget is Procedure &&
+ types.isOverloadedArithmeticOperator(interfaceTarget)) {
return types.getTypeOfOverloadedArithmetic(
receiver.getStaticType(types),
arguments.positional[0].getStaticType(types));
}
Class superclass = interfaceTarget.enclosingClass;
var receiverType = receiver.getStaticTypeAsInstanceOf(superclass, types);
- var returnType = Substitution
+ var getterType = Substitution
.fromInterfaceType(receiverType)
- .substituteType(interfaceTarget.function.returnType);
- return Substitution
- .fromPairs(interfaceTarget.function.typeParameters, arguments.types)
- .substituteType(returnType);
+ .substituteType(interfaceTarget.getterType);
+ if (getterType is FunctionType) {
+ return Substitution
+ .fromPairs(getterType.typeParameters, arguments.types)
+ .substituteType(getterType.returnType);
+ } else {
+ return const DynamicType();
+ }
}
if (name.name == 'call') {
var receiverType = receiver.getStaticType(types);

Powered by Google App Engine
This is Rietveld 408576698