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

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

Issue 2981673002: Register created closure class with the world. (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_impl.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 94215a63b5411dff60d47ba7fad2c12a71baa0f1..d43c778b541ae91d0357a941d62817fcf2216b35 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -10,7 +10,7 @@ import '../common/tasks.dart';
import '../common_elements.dart';
import '../compiler.dart';
import '../constants/constant_system.dart';
-import '../elements/elements.dart' show ClassElement, TypedefElement;
+import '../elements/elements.dart' show TypedefElement;
import '../elements/entities.dart';
import '../elements/types.dart';
import '../enqueue.dart';
@@ -384,7 +384,24 @@ class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin {
classSets);
@override
- void registerClosureClass(ClassElement cls) {
- throw new UnimplementedError('JsClosedWorld.registerClosureClass');
+ void registerClosureClass(ClassEntity cls, bool fromInstanceMember) {
+ // Tell the hierarchy that this is the super class. then we can use
+ // .getSupertypes(class)
+ ClassEntity superclass = fromInstanceMember
+ ? commonElements.boundClosureClass
+ : commonElements.closureClass;
+ ClassHierarchyNode parentNode = getClassHierarchyNode(superclass);
+ ClassHierarchyNode node = new ClassHierarchyNode(
+ parentNode, cls, getHierarchyDepth(superclass) + 1);
+ addClassHierarchyNode(cls, node);
+ for (InterfaceType type in getOrderedTypeSet(superclass).types) {
+ // TODO(efortuna): assert that the FunctionClass is in this ordered set.
+ // If not, we need to explicitly add node as a subtype of FunctionClass.
+ ClassSet subtypeSet = getClassSet(type.element);
+ subtypeSet.addSubtype(node);
+ }
+ addClassSet(cls, new ClassSet(node));
+ elementMap.addClosureClass(cls, new InterfaceType(superclass, const []));
+ node.isDirectlyInstantiated = true;
}
}
« no previous file with comments | « pkg/compiler/lib/src/js_model/elements.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698