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

Unified Diff: pkg/kernel/lib/transformations/mixin_full_resolution.dart

Issue 2918593003: Pass ClassHierarchy instead of creating it. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « pkg/kernel/lib/transformations/method_call.dart ('k') | pkg/kernel/lib/transformations/treeshaker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/transformations/mixin_full_resolution.dart
diff --git a/pkg/kernel/lib/transformations/mixin_full_resolution.dart b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
index 65b92e097109de97a2d422d2a046c1eeb254a088..7ae2c9dcc8365744061561e5bc12cdd5814dc115 100644
--- a/pkg/kernel/lib/transformations/mixin_full_resolution.dart
+++ b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
@@ -10,9 +10,10 @@ import '../core_types.dart';
import '../target/targets.dart' show Target;
import '../type_algebra.dart';
-void transformLibraries(
- Target targetInfo, CoreTypes coreTypes, List<Library> libraries) {
- new MixinFullResolution(targetInfo, coreTypes).transform(libraries);
+void transformLibraries(Target targetInfo, CoreTypes coreTypes,
+ ClassHierarchy hierarchy, List<Library> libraries) {
+ new MixinFullResolution(targetInfo, coreTypes, hierarchy)
+ .transform(libraries);
}
/// Replaces all mixin applications with regular classes, cloning all fields
@@ -23,11 +24,16 @@ void transformLibraries(
/// to their targets in this pass.
class MixinFullResolution {
final Target targetInfo;
-
final CoreTypes coreTypes;
+
+ /// The [ClassHierarchy] that should be used after applying this transformer.
+ /// If any class was updated, in general we need to create a new
+ /// [ClassHierarchy] instance, with new dispatch targets; or at least let
+ /// the existing instance know that some of its dispatch tables are not
+ /// valid anymore.
ahe 2017/06/01 11:38:29 This is a good practical work around for a complex
ClassHierarchy hierarchy;
- MixinFullResolution(this.targetInfo, this.coreTypes);
+ MixinFullResolution(this.targetInfo, this.coreTypes, this.hierarchy);
/// Transform the given new [libraries]. It is expected that all other
/// libraries have already been transformed.
@@ -47,10 +53,11 @@ class MixinFullResolution {
}
}
- // TODO(scheglov) Remove "program" once we switch to creating "hierarchy"
- // and "coreTypes" outside and passing into the transformers.
- var program = libraries.first.enclosingProgram;
- hierarchy = new ClassHierarchy(program);
+ // If there are transformed classes, we need to update hierarchy.
+ if (transformedClasses.isNotEmpty) {
+ var program = libraries.first.enclosingProgram;
+ hierarchy = new ClosedWorldClassHierarchy(program);
+ }
// Resolve all super call expressions and super initializers.
for (var library in libraries) {
« no previous file with comments | « pkg/kernel/lib/transformations/method_call.dart ('k') | pkg/kernel/lib/transformations/treeshaker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698