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

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

Issue 2941363002: Add the 'crossGettersSetters' flag to ClassHierarchy.forEachOverridePair(). (Closed)
Patch Set: Fixes for 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
« no previous file with comments | « no previous file | pkg/kernel/lib/src/incremental_class_hierarchy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/class_hierarchy.dart
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 5adc277376332e79d9983bd31f733789ca3a4567..b756146a2a2e00a389f9f68582ac0003f1f320ab 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -113,10 +113,15 @@ abstract class ClassHierarchy {
///
/// It is possible for two methods to override one another in both directions.
///
- /// Getters and setters are overridden separately. The [isSetter] callback
- /// parameter determines which type of access is being overridden.
+ /// By default getters and setters are overridden separately. The [isSetter]
+ /// callback parameter determines which type of access is being overridden.
+ ///
+ /// However if [crossGettersSetters] is set to `true`, getters might be
+ /// reported as overriding setters, and vice versa - setter overriding
+ /// getters. The callback should check the [Procedure.kind] property.
void forEachOverridePair(Class class_,
- callback(Member declaredMember, Member interfaceMember, bool isSetter));
+ callback(Member declaredMember, Member interfaceMember, bool isSetter),
+ {bool crossGettersSetters: false});
/// This method is invoked by the client after it changed the [classes], and
/// some of the information that this hierarchy might have cached, is not
@@ -377,7 +382,8 @@ class ClosedWorldClassHierarchy implements ClassHierarchy {
@override
void forEachOverridePair(Class class_,
- callback(Member declaredMember, Member interfaceMember, bool isSetter)) {
+ callback(Member declaredMember, Member interfaceMember, bool isSetter),
+ {bool crossGettersSetters: false}) {
_ClassInfo info = _infoFor[class_];
for (var supertype in class_.supers) {
var superclass = supertype.classNode;
@@ -390,6 +396,10 @@ class ClosedWorldClassHierarchy implements ClassHierarchy {
isSetter: true);
_reportOverrides(info.declaredSetters, superSetters, callback,
isSetter: true, onlyAbstract: true);
+ if (crossGettersSetters) {
+ _reportOverrides(info.declaredGettersAndCalls, superSetters, callback);
+ _reportOverrides(info.declaredSetters, superGetters, callback);
+ }
}
if (!class_.isAbstract) {
// If a non-abstract class declares an abstract method M whose
« no previous file with comments | « no previous file | pkg/kernel/lib/src/incremental_class_hierarchy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698