OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.class_hierarchy; | 4 library kernel.class_hierarchy; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 import 'dart:math'; | 7 import 'dart:math'; |
8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
9 import 'src/heap.dart'; | 9 import 'src/heap.dart'; |
10 import 'type_algebra.dart'; | 10 import 'type_algebra.dart'; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 /// mixin application are those declared in the mixed-in type. The callback is | 128 /// mixin application are those declared in the mixed-in type. The callback is |
129 /// invoked in the following case: | 129 /// invoked in the following case: |
130 /// | 130 /// |
131 /// A member declared in the class overrides a member inheritable through | 131 /// A member declared in the class overrides a member inheritable through |
132 /// one of the supertypes of the class. | 132 /// one of the supertypes of the class. |
133 /// | 133 /// |
134 /// This method will not report that a member overrides itself. A given pair | 134 /// This method will not report that a member overrides itself. A given pair |
135 /// may be reported multiple times when there are multiple inheritance paths | 135 /// may be reported multiple times when there are multiple inheritance paths |
136 /// to the overridden member. | 136 /// to the overridden member. |
137 /// | 137 /// |
138 /// By default getters and setters are overridden separately. The [isSetter] | 138 /// The [isSetter] callback parameter corresponds to whether [declaredMember] |
139 /// callback parameter corresponds to whether [declaredMember] is a setter. | 139 /// is a setter. |
140 void forEachCrossOverridePair(Class class_, | 140 void forEachCrossOverridePair(Class class_, |
141 callback(Member declaredMember, Member interfaceMember, bool isSetter)); | 141 callback(Member declaredMember, Member interfaceMember, bool isSetter)); |
142 | 142 |
143 /// This method is invoked by the client after it changed the [classes], and | 143 /// This method is invoked by the client after it changed the [classes], and |
144 /// some of the information that this hierarchy might have cached, is not | 144 /// some of the information that this hierarchy might have cached, is not |
145 /// valid anymore. The hierarchy may perform required updates and return the | 145 /// valid anymore. The hierarchy may perform required updates and return the |
146 /// same instance, or return a new instance. | 146 /// same instance, or return a new instance. |
147 ClassHierarchy applyChanges(Iterable<Class> classes); | 147 ClassHierarchy applyChanges(Iterable<Class> classes); |
148 } | 148 } |
149 | 149 |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 class _LubHeap extends Heap<_ClassInfo> { | 1168 class _LubHeap extends Heap<_ClassInfo> { |
1169 @override | 1169 @override |
1170 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); | 1170 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); |
1171 | 1171 |
1172 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { | 1172 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { |
1173 if (a.depth > b.depth) return true; | 1173 if (a.depth > b.depth) return true; |
1174 if (a.depth < b.depth) return false; | 1174 if (a.depth < b.depth) return false; |
1175 return a.topologicalIndex < b.topologicalIndex; | 1175 return a.topologicalIndex < b.topologicalIndex; |
1176 } | 1176 } |
1177 } | 1177 } |
OLD | NEW |