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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 _ensureSupertypes(cls, env); | 543 _ensureSupertypes(cls, env); |
544 return env.orderedTypeSet; | 544 return env.orderedTypeSet; |
545 } | 545 } |
546 | 546 |
547 int _getHierarchyDepth(KClass cls) { | 547 int _getHierarchyDepth(KClass cls) { |
548 _KClassEnv env = _classEnvs[cls.classIndex]; | 548 _KClassEnv env = _classEnvs[cls.classIndex]; |
549 _ensureSupertypes(cls, env); | 549 _ensureSupertypes(cls, env); |
550 return env.orderedTypeSet.maxDepth; | 550 return env.orderedTypeSet.maxDepth; |
551 } | 551 } |
552 | 552 |
| 553 ClassEntity _getAppliedMixin(KClass cls) { |
| 554 _KClassEnv env = _classEnvs[cls.classIndex]; |
| 555 _ensureSupertypes(cls, env); |
| 556 return env.mixedInType?.element; |
| 557 } |
| 558 |
553 DartType _substByContext(DartType type, InterfaceType context) { | 559 DartType _substByContext(DartType type, InterfaceType context) { |
554 return type.subst( | 560 return type.subst( |
555 context.typeArguments, _getThisType(context.element).typeArguments); | 561 context.typeArguments, _getThisType(context.element).typeArguments); |
556 } | 562 } |
557 | 563 |
558 InterfaceType _getSuperType(KClass cls) { | 564 InterfaceType _getSuperType(KClass cls) { |
559 _KClassEnv env = _classEnvs[cls.classIndex]; | 565 _KClassEnv env = _classEnvs[cls.classIndex]; |
560 _ensureSupertypes(cls, env); | 566 _ensureSupertypes(cls, env); |
561 return env.supertype; | 567 return env.supertype; |
562 } | 568 } |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 return false; | 1467 return false; |
1462 } | 1468 } |
1463 | 1469 |
1464 @override | 1470 @override |
1465 int getHierarchyDepth(ClassEntity cls) { | 1471 int getHierarchyDepth(ClassEntity cls) { |
1466 return elementMap._getHierarchyDepth(cls); | 1472 return elementMap._getHierarchyDepth(cls); |
1467 } | 1473 } |
1468 | 1474 |
1469 @override | 1475 @override |
1470 ClassEntity getAppliedMixin(ClassEntity cls) { | 1476 ClassEntity getAppliedMixin(ClassEntity cls) { |
1471 // TODO(johnniwinther): Implement this. | 1477 return elementMap._getAppliedMixin(cls); |
1472 return null; | |
1473 } | 1478 } |
1474 | 1479 |
1475 @override | 1480 @override |
1476 bool validateClass(ClassEntity cls) => true; | 1481 bool validateClass(ClassEntity cls) => true; |
1477 | 1482 |
1478 @override | 1483 @override |
1479 bool checkClass(ClassEntity cls) => true; | 1484 bool checkClass(ClassEntity cls) => true; |
1480 } | 1485 } |
1481 | 1486 |
1482 // Interface for testing equivalence of Kernel-based entities. | 1487 // Interface for testing equivalence of Kernel-based entities. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 return node.isExternal && | 1553 return node.isExternal && |
1549 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1554 !elementMap.isForeignLibrary(node.enclosingLibrary); |
1550 } | 1555 } |
1551 | 1556 |
1552 @override | 1557 @override |
1553 bool isJsInteropMember(MemberEntity element) { | 1558 bool isJsInteropMember(MemberEntity element) { |
1554 // TODO(johnniwinther): Compute this. | 1559 // TODO(johnniwinther): Compute this. |
1555 return false; | 1560 return false; |
1556 } | 1561 } |
1557 } | 1562 } |
OLD | NEW |