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.elements; | 5 library dart2js.js_model.elements; |
6 | 6 |
7 import '../common_elements.dart'; | 7 import '../common_elements.dart'; |
8 import '../constants/constant_system.dart'; | 8 import '../constants/constant_system.dart'; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
11 import '../elements/names.dart'; | 11 import '../elements/names.dart'; |
12 import '../elements/types.dart'; | 12 import '../elements/types.dart'; |
13 import '../js_backend/backend_usage.dart'; | 13 import '../js_backend/backend_usage.dart'; |
14 import '../js_backend/interceptor_data.dart'; | 14 import '../js_backend/interceptor_data.dart'; |
15 import '../js_backend/native_data.dart'; | 15 import '../js_backend/native_data.dart'; |
16 import '../kernel/elements.dart'; | 16 import '../kernel/elements.dart'; |
| 17 import '../kernel/element_map_impl.dart'; |
17 import '../native/behavior.dart'; | 18 import '../native/behavior.dart'; |
18 import '../ordered_typeset.dart'; | 19 import '../ordered_typeset.dart'; |
19 import '../universe/class_set.dart'; | 20 import '../universe/class_set.dart'; |
20 import '../universe/function_set.dart'; | |
21 import '../universe/selector.dart'; | 21 import '../universe/selector.dart'; |
22 import '../universe/world_builder.dart'; | 22 import '../universe/world_builder.dart'; |
23 import '../world.dart'; | 23 import '../world.dart'; |
24 | 24 |
25 /// Bidirectional map between 'frontend' and 'backend' elements. | 25 /// Bidirectional map between 'frontend' and 'backend' elements. |
26 /// | 26 /// |
27 /// Frontend elements are what we read in, these typically represents concepts | 27 /// Frontend elements are what we read in, these typically represents concepts |
28 /// in Dart. Backend elements are what we generate, these may include elements | 28 /// in Dart. Backend elements are what we generate, these may include elements |
29 /// that do not correspond to a Dart concept, such as closure classes. | 29 /// that do not correspond to a Dart concept, such as closure classes. |
30 /// | 30 /// |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 final Entity typeDeclaration; | 513 final Entity typeDeclaration; |
514 final String name; | 514 final String name; |
515 final int index; | 515 final int index; |
516 | 516 |
517 JTypeVariable(this.typeDeclaration, this.name, this.index); | 517 JTypeVariable(this.typeDeclaration, this.name, this.index); |
518 | 518 |
519 String toString() => | 519 String toString() => |
520 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; | 520 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; |
521 } | 521 } |
522 | 522 |
523 class JsClosedWorld extends ClosedWorldBase { | 523 class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin { |
524 JsClosedWorld( | 524 JsClosedWorld( |
525 {ElementEnvironment elementEnvironment, | 525 {ElementEnvironment elementEnvironment, |
526 DartTypes dartTypes, | 526 DartTypes dartTypes, |
527 CommonElements commonElements, | 527 CommonElements commonElements, |
528 ConstantSystem constantSystem, | 528 ConstantSystem constantSystem, |
529 NativeData nativeData, | 529 NativeData nativeData, |
530 InterceptorData interceptorData, | 530 InterceptorData interceptorData, |
531 BackendUsage backendUsage, | 531 BackendUsage backendUsage, |
532 ResolutionWorldBuilder resolutionWorldBuilder, | 532 ResolutionWorldBuilder resolutionWorldBuilder, |
533 Set<ClassEntity> implementedClasses, | 533 Set<ClassEntity> implementedClasses, |
534 FunctionSet functionSet, | 534 Iterable<MemberEntity> liveInstanceMembers, |
535 Set<TypedefElement> allTypedefs, | 535 Set<TypedefElement> allTypedefs, |
536 Map<ClassEntity, Set<ClassEntity>> mixinUses, | 536 Map<ClassEntity, Set<ClassEntity>> mixinUses, |
537 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, | 537 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, |
538 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, | 538 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, |
539 Map<ClassEntity, ClassSet> classSets}) | 539 Map<ClassEntity, ClassSet> classSets}) |
540 : super( | 540 : super( |
541 elementEnvironment: elementEnvironment, | 541 elementEnvironment, |
542 dartTypes: dartTypes, | 542 dartTypes, |
543 commonElements: commonElements, | 543 commonElements, |
544 constantSystem: constantSystem, | 544 constantSystem, |
545 nativeData: nativeData, | 545 nativeData, |
546 interceptorData: interceptorData, | 546 interceptorData, |
547 backendUsage: backendUsage, | 547 backendUsage, |
548 resolutionWorldBuilder: resolutionWorldBuilder, | 548 resolutionWorldBuilder, |
549 implementedClasses: implementedClasses, | 549 implementedClasses, |
550 functionSet: functionSet, | 550 liveInstanceMembers, |
551 allTypedefs: allTypedefs, | 551 allTypedefs, |
552 mixinUses: mixinUses, | 552 mixinUses, |
553 typesImplementedBySubclasses: typesImplementedBySubclasses, | 553 typesImplementedBySubclasses, |
554 classHierarchyNodes: classHierarchyNodes, | 554 classHierarchyNodes, |
555 classSets: classSets); | 555 classSets); |
556 | 556 |
557 @override | 557 @override |
558 bool hasConcreteMatch(ClassEntity cls, Selector selector, | 558 bool hasConcreteMatch(ClassEntity cls, Selector selector, |
559 {ClassEntity stopAtSuperclass}) { | 559 {ClassEntity stopAtSuperclass}) { |
560 throw new UnimplementedError('JsClosedWorld.hasConcreteMatch'); | 560 throw new UnimplementedError('JsClosedWorld.hasConcreteMatch'); |
561 } | 561 } |
562 | 562 |
563 @override | 563 @override |
564 void registerClosureClass(ClassElement cls) { | 564 void registerClosureClass(ClassElement cls) { |
565 throw new UnimplementedError('JsClosedWorld.registerClosureClass'); | 565 throw new UnimplementedError('JsClosedWorld.registerClosureClass'); |
566 } | 566 } |
567 | 567 |
568 @override | 568 @override |
569 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { | |
570 throw new UnimplementedError('JsClosedWorld.hasElementIn'); | |
571 } | |
572 | |
573 @override | |
574 bool checkEntity(Entity element) => true; | 569 bool checkEntity(Entity element) => true; |
575 | 570 |
576 @override | 571 @override |
577 bool checkClass(ClassEntity cls) => true; | 572 bool checkClass(ClassEntity cls) => true; |
578 | 573 |
579 @override | 574 @override |
580 bool checkInvariants(ClassEntity cls, {bool mustBeInstantiated: true}) { | 575 bool checkInvariants(ClassEntity cls, {bool mustBeInstantiated: true}) { |
581 return true; | 576 return true; |
582 } | 577 } |
583 | 578 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 768 |
774 @override | 769 @override |
775 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed; | 770 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed; |
776 | 771 |
777 @override | 772 @override |
778 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed; | 773 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed; |
779 | 774 |
780 @override | 775 @override |
781 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed; | 776 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed; |
782 } | 777 } |
OLD | NEW |