Chromium Code Reviews| Index: pkg/kernel/lib/class_hierarchy.dart |
| diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart |
| index c17bd8c11d07424108ab78050ccfb0801f790249..b0ce1064b22df6c8ec3b02f5b02199096dbde27e 100644 |
| --- a/pkg/kernel/lib/class_hierarchy.dart |
| +++ b/pkg/kernel/lib/class_hierarchy.dart |
| @@ -120,10 +120,19 @@ abstract class ClassHierarchy { |
| /// parameter determines which type of access is being overridden. |
| void forEachOverridePair(Class class_, |
| callback(Member declaredMember, Member interfaceMember, bool isSetter)); |
| + |
| + /// This method is invoked by the client after it changed the [changed] |
| + /// classes, and some of the information that this hierarchy might have |
| + /// cached, is not valid anymore. The hierarchy may perform required |
| + /// updates and return the same instance, or return a new instance. |
| + ClassHierarchy applyChanges(Iterable<Class> changed); |
|
ahe
2017/06/08 20:18:10
I suggest that you rename this parameter to classe
scheglov
2017/06/08 21:00:25
Done.
|
| } |
| /// Implementation of [ClassHierarchy] for closed world. |
| class ClosedWorldClassHierarchy implements ClassHierarchy { |
| + /// The [Program] that this class hierarchy represents. |
| + final Program program; |
|
ahe
2017/06/08 20:18:10
Private?
scheglov
2017/06/08 21:00:24
Done.
|
| + |
| /// All classes in the program. |
| /// |
| /// The list is ordered so that classes occur after their super classes. |
| @@ -447,7 +456,13 @@ class ClosedWorldClassHierarchy implements ClassHierarchy { |
| return new ClassSet(this, _infoFor[class_].subclassIntervalList); |
| } |
| - ClosedWorldClassHierarchy._internal(Program program, int numberOfClasses) |
| + @override |
| + ClassHierarchy applyChanges(Iterable<Class> changed) { |
| + if (changed.isEmpty) return this; |
| + return new ClosedWorldClassHierarchy(program); |
| + } |
| + |
| + ClosedWorldClassHierarchy._internal(this.program, int numberOfClasses) |
| : classes = new List<Class>(numberOfClasses) { |
| // Build the class ordering based on a topological sort. |
| for (var library in program.libraries) { |