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

Side by Side Diff: pkg/kernel/lib/class_hierarchy.dart

Issue 3004023002: Revert "Fix forEachOverridePair in the case where the class in question is abstract." (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/kernel/lib/src/incremental_class_hierarchy.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 var superGetters = getInterfaceMembers(superclass); 410 var superGetters = getInterfaceMembers(superclass);
411 var superSetters = getInterfaceMembers(superclass, setters: true); 411 var superSetters = getInterfaceMembers(superclass, setters: true);
412 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback); 412 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback);
413 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback, 413 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback,
414 onlyAbstract: true); 414 onlyAbstract: true);
415 _reportOverrides(info.implementedSetters, superSetters, callback, 415 _reportOverrides(info.implementedSetters, superSetters, callback,
416 isSetter: true); 416 isSetter: true);
417 _reportOverrides(info.declaredSetters, superSetters, callback, 417 _reportOverrides(info.declaredSetters, superSetters, callback,
418 isSetter: true, onlyAbstract: true); 418 isSetter: true, onlyAbstract: true);
419 } 419 }
420 // If a class declares an abstract method M whose 420 if (!class_.isAbstract) {
421 // implementation M' is inherited from the superclass, then the inherited 421 // If a non-abstract class declares an abstract method M whose
422 // method M' overrides the declared method M. 422 // implementation M' is inherited from the superclass, then the inherited
423 // This flies in the face of conventional override logic, but is necessary 423 // method M' overrides the declared method M.
424 // because an instance of the class will contain the method M' which can 424 // This flies in the face of conventional override logic, but is necessary
425 // be invoked through the interface of M. 425 // because an instance of the class will contain the method M' which can
426 // Note that [_reportOverrides] does not report self-overrides, so in 426 // be invoked through the interface of M.
427 // most cases these calls will just scan both lists and report nothing. 427 // Note that [_reportOverrides] does not report self-overrides, so in
428 _reportOverrides(info.implementedGettersAndCalls, 428 // most cases these calls will just scan both lists and report nothing.
429 info.declaredGettersAndCalls, callback); 429 _reportOverrides(info.implementedGettersAndCalls,
430 _reportOverrides(info.implementedSetters, info.declaredSetters, callback, 430 info.declaredGettersAndCalls, callback);
431 isSetter: true); 431 _reportOverrides(info.implementedSetters, info.declaredSetters, callback,
432 isSetter: true);
433 }
432 } 434 }
433 435
434 @override 436 @override
435 void forEachCrossOverridePair(Class class_, 437 void forEachCrossOverridePair(Class class_,
436 callback(Member declaredMember, Member interfaceMember, bool isSetter), 438 callback(Member declaredMember, Member interfaceMember, bool isSetter),
437 {bool crossGettersSetters: false}) { 439 {bool crossGettersSetters: false}) {
438 _ClassInfo info = _infoFor[class_]; 440 _ClassInfo info = _infoFor[class_];
439 for (var supertype in class_.supers) { 441 for (var supertype in class_.supers) {
440 var superclass = supertype.classNode; 442 var superclass = supertype.classNode;
441 var superGetters = getInterfaceMembers(superclass); 443 var superGetters = getInterfaceMembers(superclass);
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 class _LubHeap extends Heap<_ClassInfo> { 1171 class _LubHeap extends Heap<_ClassInfo> {
1170 @override 1172 @override
1171 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); 1173 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b);
1172 1174
1173 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { 1175 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) {
1174 if (a.depth > b.depth) return true; 1176 if (a.depth > b.depth) return true;
1175 if (a.depth < b.depth) return false; 1177 if (a.depth < b.depth) return false;
1176 return a.topologicalIndex < b.topologicalIndex; 1178 return a.topologicalIndex < b.topologicalIndex;
1177 } 1179 }
1178 } 1180 }
OLDNEW
« 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