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.kernel.element_map; | 5 library dart2js.kernel.element_map; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 import 'package:kernel/clone.dart'; | 8 import 'package:kernel/clone.dart'; |
9 import 'package:kernel/type_algebra.dart'; | 9 import 'package:kernel/type_algebra.dart'; |
10 | 10 |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 | 1493 |
1494 @override | 1494 @override |
1495 bool validateClass(ClassEntity cls) => true; | 1495 bool validateClass(ClassEntity cls) => true; |
1496 | 1496 |
1497 @override | 1497 @override |
1498 bool checkClass(ClassEntity cls) => true; | 1498 bool checkClass(ClassEntity cls) => true; |
1499 } | 1499 } |
1500 | 1500 |
1501 class KernelClosedWorld extends ClosedWorldBase { | 1501 class KernelClosedWorld extends ClosedWorldBase { |
1502 final KernelToElementMapImpl _elementMap; | 1502 final KernelToElementMapImpl _elementMap; |
1503 final ElementEnvironment _elementEnvironment; | |
1504 | 1503 |
1505 KernelClosedWorld(this._elementMap, | 1504 KernelClosedWorld(this._elementMap, |
1506 {ElementEnvironment elementEnvironment, | 1505 {ElementEnvironment elementEnvironment, |
1507 CommonElements commonElements, | 1506 CommonElements commonElements, |
1508 ConstantSystem constantSystem, | 1507 ConstantSystem constantSystem, |
1509 NativeData nativeData, | 1508 NativeData nativeData, |
1510 InterceptorData interceptorData, | 1509 InterceptorData interceptorData, |
1511 BackendUsage backendUsage, | 1510 BackendUsage backendUsage, |
1512 ResolutionWorldBuilder resolutionWorldBuilder, | 1511 ResolutionWorldBuilder resolutionWorldBuilder, |
1513 Set<ClassEntity> implementedClasses, | 1512 Set<ClassEntity> implementedClasses, |
1514 FunctionSet functionSet, | 1513 FunctionSet functionSet, |
1515 Set<TypedefElement> allTypedefs, | 1514 Set<TypedefElement> allTypedefs, |
1516 Map<ClassEntity, Set<ClassEntity>> mixinUses, | 1515 Map<ClassEntity, Set<ClassEntity>> mixinUses, |
1517 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, | 1516 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses, |
1518 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, | 1517 Map<ClassEntity, ClassHierarchyNode> classHierarchyNodes, |
1519 Map<ClassEntity, ClassSet> classSets}) | 1518 Map<ClassEntity, ClassSet> classSets}) |
1520 : this._elementEnvironment = elementEnvironment, | 1519 : super( |
1521 super( | 1520 elementEnvironment: elementEnvironment, |
1522 commonElements: commonElements, | 1521 commonElements: commonElements, |
1523 constantSystem: constantSystem, | 1522 constantSystem: constantSystem, |
1524 nativeData: nativeData, | 1523 nativeData: nativeData, |
1525 interceptorData: interceptorData, | 1524 interceptorData: interceptorData, |
1526 backendUsage: backendUsage, | 1525 backendUsage: backendUsage, |
1527 resolutionWorldBuilder: resolutionWorldBuilder, | 1526 resolutionWorldBuilder: resolutionWorldBuilder, |
1528 implementedClasses: implementedClasses, | 1527 implementedClasses: implementedClasses, |
1529 functionSet: functionSet, | 1528 functionSet: functionSet, |
1530 allTypedefs: allTypedefs, | 1529 allTypedefs: allTypedefs, |
1531 mixinUses: mixinUses, | 1530 mixinUses: mixinUses, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 bool checkEntity(Entity element) => true; | 1579 bool checkEntity(Entity element) => true; |
1581 | 1580 |
1582 @override | 1581 @override |
1583 void registerClosureClass(ClassElement cls) { | 1582 void registerClosureClass(ClassElement cls) { |
1584 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); | 1583 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); |
1585 } | 1584 } |
1586 | 1585 |
1587 @override | 1586 @override |
1588 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { | 1587 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { |
1589 while (cls != null) { | 1588 while (cls != null) { |
1590 MemberEntity member = _elementEnvironment | 1589 MemberEntity member = elementEnvironment |
1591 .lookupClassMember(cls, selector.name, setter: selector.isSetter); | 1590 .lookupClassMember(cls, selector.name, setter: selector.isSetter); |
1592 if (member != null && | 1591 if (member != null && |
1593 (!selector.memberName.isPrivate || | 1592 (!selector.memberName.isPrivate || |
1594 member.library == selector.library)) { | 1593 member.library == selector.library)) { |
1595 return member == element; | 1594 return member == element; |
1596 } | 1595 } |
1597 cls = _elementEnvironment.getSuperClass(cls); | 1596 cls = elementEnvironment.getSuperClass(cls); |
1598 } | 1597 } |
1599 return false; | 1598 return false; |
1600 } | 1599 } |
1601 } | 1600 } |
1602 | 1601 |
1603 // Interface for testing equivalence of Kernel-based entities. | 1602 // Interface for testing equivalence of Kernel-based entities. |
1604 class WorldDeconstructionForTesting { | 1603 class WorldDeconstructionForTesting { |
1605 final KernelToElementMapImpl elementMap; | 1604 final KernelToElementMapImpl elementMap; |
1606 | 1605 |
1607 WorldDeconstructionForTesting(this.elementMap); | 1606 WorldDeconstructionForTesting(this.elementMap); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 return node.isExternal && | 1668 return node.isExternal && |
1670 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1669 !elementMap.isForeignLibrary(node.enclosingLibrary); |
1671 } | 1670 } |
1672 | 1671 |
1673 @override | 1672 @override |
1674 bool isJsInteropMember(MemberEntity element) { | 1673 bool isJsInteropMember(MemberEntity element) { |
1675 // TODO(johnniwinther): Compute this. | 1674 // TODO(johnniwinther): Compute this. |
1676 return false; | 1675 return false; |
1677 } | 1676 } |
1678 } | 1677 } |
OLD | NEW |