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

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

Issue 2946733003: Fix type inference of getters that "override" setters and vice versa. (Closed)
Patch Set: Address code review comments 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/kernel/kernel_class_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 7630c71e5cf8096a63744be0fe88cd75a57bd228..cde2c48bfae47204ad694cbec904c1c40a0526c5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -182,6 +182,7 @@ abstract class KernelClassBuilder
void checkOverrides(ClassHierarchy hierarchy) {
hierarchy.forEachOverridePair(cls, checkOverride);
+ hierarchy.forEachCrossOverridePair(cls, handleCrossOverride);
}
void checkOverride(
@@ -208,6 +209,17 @@ abstract class KernelClassBuilder
}
}
+ void handleCrossOverride(
+ Member declaredMember, Member interfaceMember, bool isSetter) {
+ // Record any cases where a field or getter/setter has a corresponding (but
+ // opposite) getter/setter in a superclass, since this information will be
+ // needed for type inference.
+ if (declaredMember is KernelMember &&
+ identical(declaredMember.enclosingClass, cls)) {
+ KernelMember.recordCrossOverride(declaredMember, interfaceMember);
+ }
+ }
+
void checkMethodOverride(
Procedure declaredMember, Procedure interfaceMember) {
if (declaredMember.enclosingClass != cls) {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | pkg/kernel/lib/class_hierarchy.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698