| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.js_model.strategy; | 5 library dart2js.js_model.strategy; |
| 6 | 6 |
| 7 import '../closure.dart' show ClosureConversionTask; | 7 import '../closure.dart' show ClosureConversionTask; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/tasks.dart'; | 9 import '../common/tasks.dart'; |
| 10 import '../common_elements.dart'; | 10 import '../common_elements.dart'; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 liveNativeClasses, | 376 liveNativeClasses, |
| 377 liveInstanceMembers, | 377 liveInstanceMembers, |
| 378 assignedInstanceMembers, | 378 assignedInstanceMembers, |
| 379 allTypedefs, | 379 allTypedefs, |
| 380 mixinUses, | 380 mixinUses, |
| 381 typesImplementedBySubclasses, | 381 typesImplementedBySubclasses, |
| 382 classHierarchyNodes, | 382 classHierarchyNodes, |
| 383 classSets); | 383 classSets); |
| 384 | 384 |
| 385 @override | 385 @override |
| 386 void registerClosureClass(ClassEntity cls, bool fromInstanceMember) { | 386 void registerClosureClass(ClassEntity cls) { |
| 387 // Tell the hierarchy that this is the super class. then we can use | 387 // Tell the hierarchy that this is the super class. then we can use |
| 388 // .getSupertypes(class) | 388 // .getSupertypes(class) |
| 389 ClassEntity superclass = fromInstanceMember | 389 ClassEntity superclass = commonElements.closureClass; |
| 390 ? commonElements.boundClosureClass | |
| 391 : commonElements.closureClass; | |
| 392 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); | 390 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); |
| 393 ClassHierarchyNode node = new ClassHierarchyNode( | 391 ClassHierarchyNode node = new ClassHierarchyNode( |
| 394 parentNode, cls, getHierarchyDepth(superclass) + 1); | 392 parentNode, cls, getHierarchyDepth(superclass) + 1); |
| 395 addClassHierarchyNode(cls, node); | 393 addClassHierarchyNode(cls, node); |
| 396 for (InterfaceType type in getOrderedTypeSet(superclass).types) { | 394 for (InterfaceType type in getOrderedTypeSet(superclass).types) { |
| 397 // TODO(efortuna): assert that the FunctionClass is in this ordered set. | 395 // TODO(efortuna): assert that the FunctionClass is in this ordered set. |
| 398 // If not, we need to explicitly add node as a subtype of FunctionClass. | 396 // If not, we need to explicitly add node as a subtype of FunctionClass. |
| 399 ClassSet subtypeSet = getClassSet(type.element); | 397 ClassSet subtypeSet = getClassSet(type.element); |
| 400 subtypeSet.addSubtype(node); | 398 subtypeSet.addSubtype(node); |
| 401 } | 399 } |
| 402 addClassSet(cls, new ClassSet(node)); | 400 addClassSet(cls, new ClassSet(node)); |
| 403 elementMap.addClosureClass(cls, new InterfaceType(superclass, const [])); | 401 elementMap.addClosureClass(cls, new InterfaceType(superclass, const [])); |
| 404 node.isDirectlyInstantiated = true; | 402 node.isDirectlyInstantiated = true; |
| 405 } | 403 } |
| 406 } | 404 } |
| OLD | NEW |