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

Unified Diff: pkg/compiler/lib/src/js_model/js_strategy.dart

Issue 2984263002: Make the ClosedWorld build the closure class on the kernel side. (Closed)
Patch Set: . Created 3 years, 5 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/compiler/lib/src/js_model/elements.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_model/js_strategy.dart
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 227c2856343475dc92077642cb08ec4091dacdf1..99dc8e0793eb5c8d6ec29f5fd037c7f66d53c014 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -4,6 +4,8 @@
library dart2js.js_model.strategy;
+import 'package:kernel/ast.dart' as ir;
+
import '../closure.dart' show ClosureConversionTask;
import '../common.dart';
import '../common/tasks.dart';
@@ -382,11 +384,22 @@ class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin {
classHierarchyNodes,
classSets);
- @override
- void registerClosureClass(ClassEntity cls) {
+ /// Construct a closure class and set up the necessary class inference
+ /// hierarchy.
+ KernelClosureClass buildClosureClass(String name, JLibrary enclosingLibrary,
+ KernelScopeInfo info, ir.Location location, KernelToLocalsMap localsMap) {
+ ClassEntity superclass = commonElements.closureClass;
+
+ KernelClosureClass cls = elementMap.constructClosureClass(
+ name,
+ enclosingLibrary,
+ info,
+ location,
+ localsMap,
+ new InterfaceType(superclass, const []));
+
// Tell the hierarchy that this is the super class. then we can use
// .getSupertypes(class)
- ClassEntity superclass = commonElements.closureClass;
ClassHierarchyNode parentNode = getClassHierarchyNode(superclass);
ClassHierarchyNode node = new ClassHierarchyNode(
parentNode, cls, getHierarchyDepth(superclass) + 1);
@@ -398,7 +411,13 @@ class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin {
subtypeSet.addSubtype(node);
}
addClassSet(cls, new ClassSet(node));
- elementMap.addClosureClass(cls, new InterfaceType(superclass, const []));
node.isDirectlyInstantiated = true;
+
+ return cls;
+ }
+
+ @override
+ void registerClosureClass(ClassEntity cls) {
+ throw new UnsupportedError('JsClosedWorld.registerClosureClass');
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_model/elements.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698