| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 class IncrementalClassHierarchy implements ClassHierarchy { | 72 class IncrementalClassHierarchy implements ClassHierarchy { |
| 73 /// The next unique identifier for [_ClassInfo]s. | 73 /// The next unique identifier for [_ClassInfo]s. |
| 74 int _nextId = 0; | 74 int _nextId = 0; |
| 75 | 75 |
| 76 /// The mapping from [Class]es to the corresponding [_ClassInfo]s. | 76 /// The mapping from [Class]es to the corresponding [_ClassInfo]s. |
| 77 /// The map is ordered in such a way that classes are after superclasses. | 77 /// The map is ordered in such a way that classes are after superclasses. |
| 78 /// It is filled lazily as the client requests information about classes. | 78 /// It is filled lazily as the client requests information about classes. |
| 79 final Map<Class, _ClassInfo> _info = new LinkedHashMap<Class, _ClassInfo>(); | 79 final Map<Class, _ClassInfo> _info = new LinkedHashMap<Class, _ClassInfo>(); |
| 80 | 80 |
| 81 @override | 81 @override |
| 82 ClassHierarchy applyChanges(Iterable<Class> classes) { |
| 83 if (classes.isEmpty) return this; |
| 84 return new IncrementalClassHierarchy(); |
| 85 } |
| 86 |
| 87 @override |
| 82 void forEachOverridePair(Class node, | 88 void forEachOverridePair(Class node, |
| 83 callback(Member declaredMember, Member interfaceMember, bool isSetter)) { | 89 callback(Member declaredMember, Member interfaceMember, bool isSetter)) { |
| 84 _ClassInfo info = _getInfo(node); | 90 _ClassInfo info = _getInfo(node); |
| 85 for (var supertype in node.supers) { | 91 for (var supertype in node.supers) { |
| 86 var superNode = supertype.classNode; | 92 var superNode = supertype.classNode; |
| 87 var superInfo = _getInfo(superNode); | 93 var superInfo = _getInfo(superNode); |
| 88 | 94 |
| 89 var superGetters = superInfo.interfaceGettersAndCalls; | 95 var superGetters = superInfo.interfaceGettersAndCalls; |
| 90 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback); | 96 _reportOverrides(info.implementedGettersAndCalls, superGetters, callback); |
| 91 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback, | 97 _reportOverrides(info.declaredGettersAndCalls, superGetters, callback, |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 class _LubHeap extends Heap<_ClassInfo> { | 718 class _LubHeap extends Heap<_ClassInfo> { |
| 713 @override | 719 @override |
| 714 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); | 720 bool sortsBefore(_ClassInfo a, _ClassInfo b) => sortsBeforeStatic(a, b); |
| 715 | 721 |
| 716 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { | 722 static bool sortsBeforeStatic(_ClassInfo a, _ClassInfo b) { |
| 717 if (a.depth > b.depth) return true; | 723 if (a.depth > b.depth) return true; |
| 718 if (a.depth < b.depth) return false; | 724 if (a.depth < b.depth) return false; |
| 719 return a.id < b.id; | 725 return a.id < b.id; |
| 720 } | 726 } |
| 721 } | 727 } |
| OLD | NEW |