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; |
} |
} |