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

Unified Diff: pkg/kernel/lib/class_hierarchy.dart

Issue 2924333002: Use ClassHierarchy.applyChanges() in MixinFullResolution. (Closed)
Patch Set: Changes for review comments. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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..0968b720dcb20d5055f30ed9df1fe2b660540d98 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 [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> classes);
}
/// Implementation of [ClassHierarchy] for closed world.
class ClosedWorldClassHierarchy implements ClassHierarchy {
+ /// The [Program] that this class hierarchy represents.
+ final Program _program;
+
/// All classes in the program.
///
/// The list is ordered so that classes occur after their super classes.
@@ -447,10 +456,16 @@ class ClosedWorldClassHierarchy implements ClassHierarchy {
return new ClassSet(this, _infoFor[class_].subclassIntervalList);
}
- ClosedWorldClassHierarchy._internal(Program program, int numberOfClasses)
+ @override
+ ClassHierarchy applyChanges(Iterable<Class> classes) {
+ if (classes.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) {
+ for (var library in _program.libraries) {
for (var classNode in library.classes) {
_topologicalSortVisit(classNode);
}
« no previous file with comments | « pkg/analyzer/lib/src/fasta/analyzer_loader.dart ('k') | pkg/kernel/lib/src/incremental_class_hierarchy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698