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'; |
11 import '../compiler.dart'; | 11 import '../compiler.dart'; |
12 import '../constants/constant_system.dart'; | 12 import '../constants/constant_system.dart'; |
13 import '../elements/elements.dart' show ClassElement, TypedefElement; | 13 import '../elements/elements.dart' show TypedefElement; |
14 import '../elements/entities.dart'; | 14 import '../elements/entities.dart'; |
15 import '../elements/types.dart'; | 15 import '../elements/types.dart'; |
16 import '../enqueue.dart'; | 16 import '../enqueue.dart'; |
17 import '../io/source_information.dart'; | 17 import '../io/source_information.dart'; |
18 import '../js_emitter/sorter.dart'; | 18 import '../js_emitter/sorter.dart'; |
19 import '../js/js_source_mapping.dart'; | 19 import '../js/js_source_mapping.dart'; |
20 import '../js_backend/backend.dart'; | 20 import '../js_backend/backend.dart'; |
21 import '../js_backend/backend_usage.dart'; | 21 import '../js_backend/backend_usage.dart'; |
22 import '../js_backend/constant_system_javascript.dart'; | 22 import '../js_backend/constant_system_javascript.dart'; |
23 import '../js_backend/interceptor_data.dart'; | 23 import '../js_backend/interceptor_data.dart'; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 liveNativeClasses, | 377 liveNativeClasses, |
378 liveInstanceMembers, | 378 liveInstanceMembers, |
379 assignedInstanceMembers, | 379 assignedInstanceMembers, |
380 allTypedefs, | 380 allTypedefs, |
381 mixinUses, | 381 mixinUses, |
382 typesImplementedBySubclasses, | 382 typesImplementedBySubclasses, |
383 classHierarchyNodes, | 383 classHierarchyNodes, |
384 classSets); | 384 classSets); |
385 | 385 |
386 @override | 386 @override |
387 void registerClosureClass(ClassElement cls) { | 387 void registerClosureClass(ClassEntity cls, bool fromInstanceMember) { |
388 throw new UnimplementedError('JsClosedWorld.registerClosureClass'); | 388 // Tell the hierarchy that this is the super class. then we can use |
| 389 // .getSupertypes(class) |
| 390 ClassEntity superclass = fromInstanceMember |
| 391 ? commonElements.boundClosureClass |
| 392 : commonElements.closureClass; |
| 393 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); |
| 394 ClassHierarchyNode node = new ClassHierarchyNode( |
| 395 parentNode, cls, getHierarchyDepth(superclass) + 1); |
| 396 addClassHierarchyNode(cls, node); |
| 397 for (InterfaceType type in getOrderedTypeSet(superclass).types) { |
| 398 // TODO(efortuna): assert that the FunctionClass is in this ordered set. |
| 399 // If not, we need to explicitly add node as a subtype of FunctionClass. |
| 400 ClassSet subtypeSet = getClassSet(type.element); |
| 401 subtypeSet.addSubtype(node); |
| 402 } |
| 403 addClassSet(cls, new ClassSet(node)); |
| 404 elementMap.addClosureClass(cls, new InterfaceType(superclass, const [])); |
| 405 node.isDirectlyInstantiated = true; |
389 } | 406 } |
390 } | 407 } |
OLD | NEW |