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 '../kernel/element_map_impl.dart'; |
18 import '../native/behavior.dart'; | 18 import '../native/behavior.dart'; |
19 import '../ordered_typeset.dart'; | |
20 import '../universe/class_set.dart'; | 19 import '../universe/class_set.dart'; |
21 import '../universe/selector.dart'; | |
22 import '../universe/world_builder.dart'; | 20 import '../universe/world_builder.dart'; |
23 import '../world.dart'; | 21 import '../world.dart'; |
24 | 22 |
25 /// Bidirectional map between 'frontend' and 'backend' elements. | 23 /// Bidirectional map between 'frontend' and 'backend' elements. |
26 /// | 24 /// |
27 /// Frontend elements are what we read in, these typically represents concepts | 25 /// Frontend elements are what we read in, these typically represents concepts |
28 /// in Dart. Backend elements are what we generate, these may include elements | 26 /// 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. | 27 /// that do not correspond to a Dart concept, such as closure classes. |
30 /// | 28 /// |
31 /// Querying for the frontend element for a backend-only element throws an | 29 /// Querying for the frontend element for a backend-only element throws an |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 final String name; | 512 final String name; |
515 final int index; | 513 final int index; |
516 | 514 |
517 JTypeVariable(this.typeDeclaration, this.name, this.index); | 515 JTypeVariable(this.typeDeclaration, this.name, this.index); |
518 | 516 |
519 String toString() => | 517 String toString() => |
520 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; | 518 '${jsElementPrefix}type_variable(${typeDeclaration.name}.$name)'; |
521 } | 519 } |
522 | 520 |
523 class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin { | 521 class JsClosedWorld extends ClosedWorldBase with KernelClosedWorldMixin { |
524 JsClosedWorld( | 522 final JsKernelToElementMap elementMap; |
| 523 |
| 524 JsClosedWorld(this.elementMap, |
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 Iterable<MemberEntity> liveInstanceMembers, | 534 Iterable<MemberEntity> liveInstanceMembers, |
(...skipping 13 matching lines...) Expand all Loading... |
548 resolutionWorldBuilder, | 548 resolutionWorldBuilder, |
549 implementedClasses, | 549 implementedClasses, |
550 liveInstanceMembers, | 550 liveInstanceMembers, |
551 allTypedefs, | 551 allTypedefs, |
552 mixinUses, | 552 mixinUses, |
553 typesImplementedBySubclasses, | 553 typesImplementedBySubclasses, |
554 classHierarchyNodes, | 554 classHierarchyNodes, |
555 classSets); | 555 classSets); |
556 | 556 |
557 @override | 557 @override |
558 bool hasConcreteMatch(ClassEntity cls, Selector selector, | |
559 {ClassEntity stopAtSuperclass}) { | |
560 throw new UnimplementedError('JsClosedWorld.hasConcreteMatch'); | |
561 } | |
562 | |
563 @override | |
564 void registerClosureClass(ClassElement cls) { | 558 void registerClosureClass(ClassElement cls) { |
565 throw new UnimplementedError('JsClosedWorld.registerClosureClass'); | 559 throw new UnimplementedError('JsClosedWorld.registerClosureClass'); |
566 } | 560 } |
567 | |
568 @override | |
569 bool checkEntity(Entity element) => true; | |
570 | |
571 @override | |
572 bool checkClass(ClassEntity cls) => true; | |
573 | |
574 @override | |
575 bool checkInvariants(ClassEntity cls, {bool mustBeInstantiated: true}) { | |
576 return true; | |
577 } | |
578 | |
579 @override | |
580 OrderedTypeSet getOrderedTypeSet(ClassEntity cls) { | |
581 throw new UnimplementedError('JsClosedWorld.getOrderedTypeSet'); | |
582 } | |
583 | |
584 @override | |
585 int getHierarchyDepth(ClassEntity cls) { | |
586 throw new UnimplementedError('JsClosedWorld.getHierarchyDepth'); | |
587 } | |
588 | |
589 @override | |
590 ClassEntity getSuperClass(ClassEntity cls) { | |
591 throw new UnimplementedError('JsClosedWorld.getSuperClass'); | |
592 } | |
593 | |
594 @override | |
595 Iterable<ClassEntity> getInterfaces(ClassEntity cls) { | |
596 throw new UnimplementedError('JsClosedWorld.getInterfaces'); | |
597 } | |
598 | |
599 @override | |
600 ClassEntity getAppliedMixin(ClassEntity cls) { | |
601 throw new UnimplementedError('JsClosedWorld.getAppliedMixin'); | |
602 } | |
603 | |
604 @override | |
605 bool isNamedMixinApplication(ClassEntity cls) { | |
606 throw new UnimplementedError('JsClosedWorld.isNamedMixinApplication'); | |
607 } | |
608 } | 561 } |
609 | 562 |
610 class JsNativeData implements NativeData { | 563 class JsNativeData implements NativeData { |
611 final JsToFrontendMap _map; | 564 final JsToFrontendMap _map; |
612 final NativeData _nativeData; | 565 final NativeData _nativeData; |
613 | 566 |
614 JsNativeData(this._map, this._nativeData); | 567 JsNativeData(this._map, this._nativeData); |
615 | 568 |
616 @override | 569 @override |
617 bool isNativeClass(ClassEntity element) { | 570 bool isNativeClass(ClassEntity element) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 721 |
769 @override | 722 @override |
770 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed; | 723 bool get isFunctionApplyUsed => _backendUsage.isFunctionApplyUsed; |
771 | 724 |
772 @override | 725 @override |
773 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed; | 726 bool get isMirrorsUsed => _backendUsage.isMirrorsUsed; |
774 | 727 |
775 @override | 728 @override |
776 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed; | 729 bool get isNoSuchMethodUsed => _backendUsage.isNoSuchMethodUsed; |
777 } | 730 } |
OLD | NEW |