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

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

Issue 2959823002: Add type inference for super property gets. (Closed)
Patch Set: 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/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 5a2029a3d9ab3b8132af9f70d3b1661eaa2ab71b..d7761fe769be537f40c18f8dbbf2bbf56fd30536 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
@@ -838,14 +838,11 @@ abstract class TypeInferrerImpl extends TypeInferrer {
/// Performs the core type inference algorithm for property gets (this handles
/// both null-aware and non-null-aware property gets).
- DartType inferPropertyGet(
- Expression expression,
- Expression receiver,
- int fileOffset,
+ DartType inferPropertyGet(Expression expression, Expression receiver,
+ int fileOffset, DartType typeContext, bool typeNeeded,
+ {VariableDeclaration receiverVariable,
PropertyGet desugaredGet,
- DartType typeContext,
- bool typeNeeded,
- {VariableDeclaration receiverVariable}) {
+ Name propertyName}) {
typeNeeded =
listener.propertyGetEnter(expression, typeContext) || typeNeeded;
// First infer the receiver so we can look up the getter that was invoked.
@@ -853,8 +850,9 @@ abstract class TypeInferrerImpl extends TypeInferrer {
if (strongMode) {
receiverVariable?.type = receiverType;
}
+ propertyName ??= desugaredGet.name;
Member interfaceMember =
- findInterfaceMember(receiverType, desugaredGet.name, fileOffset);
+ findInterfaceMember(receiverType, propertyName, fileOffset);
if (isTopLevel &&
((interfaceMember is Procedure &&
interfaceMember.kind == ProcedureKind.Getter) ||
@@ -872,9 +870,9 @@ abstract class TypeInferrerImpl extends TypeInferrer {
recordNotImmediatelyEvident(fileOffset);
}
}
- desugaredGet.interfaceTarget = interfaceMember;
+ desugaredGet?.interfaceTarget = interfaceMember;
var inferredType =
- getCalleeType(interfaceMember, receiverType, desugaredGet.name);
+ getCalleeType(interfaceMember, receiverType, propertyName);
// TODO(paulberry): Infer tear-off type arguments if appropriate.
listener.propertyGetExit(expression, inferredType);
return typeNeeded ? inferredType : null;
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/front_end/testcases/inference/super_property_get.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698