Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2933093002: Revert "Handle named mixin application in emitter" (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 518
519 void _ensureSupertypes(KClass cls, _KClassEnv env) { 519 void _ensureSupertypes(KClass cls, _KClassEnv env) {
520 if (env.orderedTypeSet == null) { 520 if (env.orderedTypeSet == null) {
521 _ensureThisAndRawType(cls, env); 521 _ensureThisAndRawType(cls, env);
522 522
523 ir.Class node = env.cls; 523 ir.Class node = env.cls;
524 524
525 if (node.supertype == null) { 525 if (node.supertype == null) {
526 env.orderedTypeSet = new OrderedTypeSet.singleton(env.thisType); 526 env.orderedTypeSet = new OrderedTypeSet.singleton(env.thisType);
527 env.isMixinApplication = false;
528 } else { 527 } else {
529 InterfaceType processSupertype(ir.Supertype node) { 528 InterfaceType processSupertype(ir.Supertype node) {
530 InterfaceType type = _typeConverter.visitSupertype(node); 529 InterfaceType type = _typeConverter.visitSupertype(node);
531 KClass superclass = type.element; 530 KClass superclass = type.element;
532 _KClassEnv env = _classEnvs[superclass.classIndex]; 531 _KClassEnv env = _classEnvs[superclass.classIndex];
533 _ensureSupertypes(superclass, env); 532 _ensureSupertypes(superclass, env);
534 return type; 533 return type;
535 } 534 }
536 535
537 env.supertype = processSupertype(node.supertype); 536 env.supertype = processSupertype(node.supertype);
538 LinkBuilder<InterfaceType> linkBuilder = 537 LinkBuilder<InterfaceType> linkBuilder =
539 new LinkBuilder<InterfaceType>(); 538 new LinkBuilder<InterfaceType>();
540 if (node.mixedInType != null) { 539 if (node.mixedInType != null) {
541 env.isMixinApplication = true;
542 linkBuilder 540 linkBuilder
543 .addLast(env.mixedInType = processSupertype(node.mixedInType)); 541 .addLast(env.mixedInType = processSupertype(node.mixedInType));
544 } else {
545 env.isMixinApplication = false;
546 } 542 }
547 node.implementedTypes.forEach((ir.Supertype supertype) { 543 node.implementedTypes.forEach((ir.Supertype supertype) {
548 linkBuilder.addLast(processSupertype(supertype)); 544 linkBuilder.addLast(processSupertype(supertype));
549 }); 545 });
550 Link<InterfaceType> interfaces = linkBuilder.toLink(); 546 Link<InterfaceType> interfaces = linkBuilder.toLink();
551 OrderedTypeSetBuilder setBuilder = 547 OrderedTypeSetBuilder setBuilder =
552 new _KernelOrderedTypeSetBuilder(this, cls); 548 new _KernelOrderedTypeSetBuilder(this, cls);
553 env.orderedTypeSet = 549 env.orderedTypeSet =
554 setBuilder.createOrderedTypeSet(env.supertype, interfaces); 550 setBuilder.createOrderedTypeSet(env.supertype, interfaces);
555 } 551 }
(...skipping 22 matching lines...) Expand all
578 return type.subst( 574 return type.subst(
579 context.typeArguments, getThisType(context.element).typeArguments); 575 context.typeArguments, getThisType(context.element).typeArguments);
580 } 576 }
581 577
582 InterfaceType _getSuperType(KClass cls) { 578 InterfaceType _getSuperType(KClass cls) {
583 _KClassEnv env = _classEnvs[cls.classIndex]; 579 _KClassEnv env = _classEnvs[cls.classIndex];
584 _ensureSupertypes(cls, env); 580 _ensureSupertypes(cls, env);
585 return env.supertype; 581 return env.supertype;
586 } 582 }
587 583
588 bool _isMixinApplication(KClass cls) {
589 _KClassEnv env = _classEnvs[cls.classIndex];
590 _ensureSupertypes(cls, env);
591 return env.isMixinApplication;
592 }
593
594 bool _isUnnamedMixinApplication(KClass cls) { 584 bool _isUnnamedMixinApplication(KClass cls) {
595 _KClassEnv env = _classEnvs[cls.classIndex]; 585 _KClassEnv env = _classEnvs[cls.classIndex];
596 _ensureSupertypes(cls, env); 586 _ensureSupertypes(cls, env);
597 return env.isUnnamedMixinApplication; 587 return env.isUnnamedMixinApplication;
598 } 588 }
599 589
600 void _forEachSupertype(KClass cls, void f(InterfaceType supertype)) { 590 void _forEachSupertype(KClass cls, void f(InterfaceType supertype)) {
601 _KClassEnv env = _classEnvs[cls.classIndex]; 591 _KClassEnv env = _classEnvs[cls.classIndex];
602 _ensureSupertypes(cls, env); 592 _ensureSupertypes(cls, env);
603 env.orderedTypeSet.supertypes.forEach(f); 593 env.orderedTypeSet.supertypes.forEach(f);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } else { 864 } else {
875 // Skip fields; these are also in _memberMap. 865 // Skip fields; these are also in _memberMap.
876 } 866 }
877 } 867 }
878 } 868 }
879 } 869 }
880 870
881 /// Environment for fast lookup of class members. 871 /// Environment for fast lookup of class members.
882 class _KClassEnv { 872 class _KClassEnv {
883 final ir.Class cls; 873 final ir.Class cls;
884 bool isMixinApplication;
885 final bool isUnnamedMixinApplication; 874 final bool isUnnamedMixinApplication;
886 875
887 InterfaceType thisType; 876 InterfaceType thisType;
888 InterfaceType rawType; 877 InterfaceType rawType;
889 InterfaceType supertype; 878 InterfaceType supertype;
890 InterfaceType mixedInType; 879 InterfaceType mixedInType;
891 OrderedTypeSet orderedTypeSet; 880 OrderedTypeSet orderedTypeSet;
892 881
893 Map<String, ir.Member> _constructorMap; 882 Map<String, ir.Member> _constructorMap;
894 Map<String, ir.Member> _memberMap; 883 Map<String, ir.Member> _memberMap;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 InterfaceType getRawType(ClassEntity cls) { 1134 InterfaceType getRawType(ClassEntity cls) {
1146 return elementMap._getRawType(cls); 1135 return elementMap._getRawType(cls);
1147 } 1136 }
1148 1137
1149 @override 1138 @override
1150 bool isGenericClass(ClassEntity cls) { 1139 bool isGenericClass(ClassEntity cls) {
1151 return getThisType(cls).typeArguments.isNotEmpty; 1140 return getThisType(cls).typeArguments.isNotEmpty;
1152 } 1141 }
1153 1142
1154 @override 1143 @override
1155 bool isMixinApplication(KClass cls) {
1156 return elementMap._isMixinApplication(cls);
1157 }
1158
1159 @override
1160 bool isUnnamedMixinApplication(KClass cls) { 1144 bool isUnnamedMixinApplication(KClass cls) {
1161 return elementMap._isUnnamedMixinApplication(cls); 1145 return elementMap._isUnnamedMixinApplication(cls);
1162 } 1146 }
1163 1147
1164 @override 1148 @override
1165 DartType getTypeVariableBound(TypeVariableEntity typeVariable) { 1149 DartType getTypeVariableBound(TypeVariableEntity typeVariable) {
1166 throw new UnimplementedError( 1150 throw new UnimplementedError(
1167 'KernelElementEnvironment.getTypeVariableBound'); 1151 'KernelElementEnvironment.getTypeVariableBound');
1168 } 1152 }
1169 1153
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 return node.isExternal && 1674 return node.isExternal &&
1691 !elementMap.isForeignLibrary(node.enclosingLibrary); 1675 !elementMap.isForeignLibrary(node.enclosingLibrary);
1692 } 1676 }
1693 1677
1694 @override 1678 @override
1695 bool isJsInteropMember(MemberEntity element) { 1679 bool isJsInteropMember(MemberEntity element) {
1696 // TODO(johnniwinther): Compute this. 1680 // TODO(johnniwinther): Compute this.
1697 return false; 1681 return false;
1698 } 1682 }
1699 } 1683 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698