OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library kernel.incremental_class_hierarchy; | 4 library kernel.incremental_class_hierarchy; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 | 8 |
9 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
10 import 'package:kernel/class_hierarchy.dart'; | 10 import 'package:kernel/class_hierarchy.dart'; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback); | 98 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback); |
99 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback, | 99 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback, |
100 onlyAbstract: true); | 100 onlyAbstract: true); |
101 | 101 |
102 _reportOverrides(info.implementedSetters, superSetters, callback, | 102 _reportOverrides(info.implementedSetters, superSetters, callback, |
103 isSetter: true); | 103 isSetter: true); |
104 _reportOverrides(info.declaredSetters, superSetters, callback, | 104 _reportOverrides(info.declaredSetters, superSetters, callback, |
105 isSetter: true, onlyAbstract: true); | 105 isSetter: true, onlyAbstract: true); |
106 } | 106 } |
107 // If a class declares an abstract method M whose | 107 if (!node.isAbstract) { |
108 // implementation M' is inherited from the superclass, then the inherited | 108 // If a non-abstract class declares an abstract method M whose |
109 // method M' overrides the declared method M. | 109 // implementation M' is inherited from the superclass, then the inherited |
110 // This flies in the face of conventional override logic, but is necessary | 110 // method M' overrides the declared method M. |
111 // because an instance of the class will contain the method M' which can | 111 // This flies in the face of conventional override logic, but is necessary |
112 // be invoked through the interface of M. | 112 // because an instance of the class will contain the method M' which can |
113 // Note that [_reportOverrides] does not report self-overrides, so in | 113 // be invoked through the interface of M. |
114 // most cases these calls will just scan both lists and report nothing. | 114 // Note that [_reportOverrides] does not report self-overrides, so in |
115 _reportOverrides(info.implementedGettersAndCalls, | 115 // most cases these calls will just scan both lists and report nothing. |
116 info.declaredGettersAndCalls, callback); | 116 _reportOverrides(info.implementedGettersAndCalls, |
117 _reportOverrides(info.implementedSetters, info.declaredSetters, callback, | 117 info.declaredGettersAndCalls, callback); |
118 isSetter: true); | 118 _reportOverrides(info.implementedSetters, info.declaredSetters, callback, |
| 119 isSetter: true); |
| 120 } |
119 } | 121 } |
120 | 122 |
121 @override | 123 @override |
122 void forEachCrossOverridePair(Class node, | 124 void forEachCrossOverridePair(Class node, |
123 callback(Member declaredMember, Member interfaceMember, bool isSetter), | 125 callback(Member declaredMember, Member interfaceMember, bool isSetter), |
124 {bool crossGettersSetters: false}) { | 126 {bool crossGettersSetters: false}) { |
125 _ClassInfo info = _getInfo(node); | 127 _ClassInfo info = _getInfo(node); |
126 for (var supertype in node.supers) { | 128 for (var supertype in node.supers) { |
127 var superNode = supertype.classNode; | 129 var superNode = supertype.classNode; |
128 var superInfo = _getInfo(superNode); | 130 var superInfo = _getInfo(superNode); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 class _LubHeap extends Heap<_ClassInfo> { | 743 class _LubHeap extends Heap<_ClassInfo> { |
742 @override | 744 @override |
743 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); | 745 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); |
744 | 746 |
745 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { | 747 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { |
746 if (a.depth > b.depth) return true; | 748 if (a.depth > b.depth) return true; |
747 if (a.depth < b.depth) return false; | 749 if (a.depth < b.depth) return false; |
748 return a.id < b.id; | 750 return a.id < b.id; |
749 } | 751 } |
750 } | 752 } |
OLD | NEW |