@@ -4536,6 +4536,10 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
45364536 /// Should be used only when the element has no type parameters.
45374537 InterfaceTypeImpl ? _nullableInstance;
45384538
4539+ InterfaceTypeImpl ? _supertype;
4540+ List <InterfaceTypeImpl > _mixins = const [];
4541+ List <InterfaceTypeImpl > _interfaces = const [];
4542+
45394543 InterfaceTypeImpl ? _thisType;
45404544
45414545 /// The cached result of [allSupertypes] .
@@ -4629,9 +4633,14 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
46294633 @override
46304634 @trackedIncludedInId
46314635 List <InterfaceTypeImpl > get interfaces {
4632- return globalResultRequirements.includedInId (() {
4633- return firstFragment.interfaces;
4634- });
4636+ _ensureReadResolution ();
4637+ return _interfaces;
4638+ }
4639+
4640+ set interfaces (List <InterfaceType > interfaces) {
4641+ // TODO(paulberry): eliminate this cast by changing the type of the
4642+ // `interfaces` parameter.
4643+ _interfaces = interfaces.cast ();
46354644 }
46364645
46374646 /// Return `true` if this class represents the class '_Enum' defined in the
@@ -4649,17 +4658,32 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
46494658 @override
46504659 @trackedIncludedInId
46514660 List <InterfaceTypeImpl > get mixins {
4652- return globalResultRequirements.includedInId (() {
4653- return firstFragment.mixins;
4654- });
4661+ if (mixinInferenceCallback case var mixinInferenceCallback? ) {
4662+ var mixins = mixinInferenceCallback (this );
4663+ if (mixins != null ) {
4664+ return _mixins = mixins;
4665+ }
4666+ }
4667+
4668+ _ensureReadResolution ();
4669+ return _mixins;
4670+ }
4671+
4672+ set mixins (List <InterfaceType > mixins) {
4673+ // TODO(paulberry): eliminate this cast by changing the type of the `mixins`
4674+ // parameter.
4675+ _mixins = mixins.cast ();
46554676 }
46564677
46574678 @override
46584679 @trackedIncludedInId
46594680 InterfaceTypeImpl ? get supertype {
4660- return globalResultRequirements.includedInId (() {
4661- return firstFragment.supertype;
4662- });
4681+ _ensureReadResolution ();
4682+ return _supertype;
4683+ }
4684+
4685+ set supertype (InterfaceTypeImpl ? value) {
4686+ _supertype = value;
46634687 }
46644688
46654689 @override
@@ -4923,16 +4947,6 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
49234947abstract class InterfaceFragmentImpl extends InstanceFragmentImpl
49244948 with _InterfaceFragmentImplMixin
49254949 implements InterfaceFragment {
4926- /// A list containing all of the mixins that are applied to the class being
4927- /// extended in order to derive the superclass of this class.
4928- List <InterfaceTypeImpl > _mixins = const [];
4929-
4930- /// A list containing all of the interfaces that are implemented by this
4931- /// class.
4932- List <InterfaceTypeImpl > _interfaces = const [];
4933-
4934- InterfaceTypeImpl ? _supertype;
4935-
49364950 List <ConstructorFragmentImpl > _constructors = _Sentinel .constructorFragment;
49374951
49384952 /// Initialize a newly created class element to have the given [name] at the
@@ -4985,35 +4999,11 @@ abstract class InterfaceFragmentImpl extends InstanceFragmentImpl
49854999 InterfaceElementImpl get element;
49865000
49875001 @override
4988- List <InterfaceTypeImpl > get interfaces {
4989- _ensureReadResolution ();
4990- return _interfaces;
4991- }
5002+ List <InterfaceTypeImpl > get interfaces => element.interfaces;
49925003
4993- set interfaces (List <InterfaceType > interfaces) {
4994- // TODO(paulberry): eliminate this cast by changing the type of the
4995- // `interfaces` parameter.
4996- _interfaces = interfaces.cast ();
4997- }
49985004
49995005 @override
5000- List <InterfaceTypeImpl > get mixins {
5001- if (element.mixinInferenceCallback case var mixinInferenceCallback? ) {
5002- var mixins = mixinInferenceCallback (element);
5003- if (mixins != null ) {
5004- return _mixins = mixins;
5005- }
5006- }
5007-
5008- _ensureReadResolution ();
5009- return _mixins;
5010- }
5011-
5012- set mixins (List <InterfaceType > mixins) {
5013- // TODO(paulberry): eliminate this cast by changing the type of the `mixins`
5014- // parameter.
5015- _mixins = mixins.cast ();
5016- }
5006+ List <InterfaceTypeImpl > get mixins => element.mixins;
50175007
50185008 @override
50195009 InterfaceFragmentImpl ? get nextFragment {
@@ -5026,16 +5016,7 @@ abstract class InterfaceFragmentImpl extends InstanceFragmentImpl
50265016 }
50275017
50285018 @override
5029- InterfaceTypeImpl ? get supertype {
5030- _ensureReadResolution ();
5031- return _supertype;
5032- }
5033-
5034- set supertype (InterfaceType ? value) {
5035- // TODO(paulberry): eliminate this cast by changing the type of the `value`
5036- // parameter.
5037- _supertype = value as InterfaceTypeImpl ? ;
5038- }
5019+ InterfaceTypeImpl ? get supertype => element.supertype;
50395020
50405021 void addConstructor (ConstructorFragmentImpl fragment) {
50415022 if (identical (_constructors, _Sentinel .constructorFragment)) {
@@ -7555,6 +7536,8 @@ class MixinElementImpl extends InterfaceElementImpl implements MixinElement {
75557536 @override
75567537 final MixinFragmentImpl firstFragment;
75577538
7539+ List <InterfaceTypeImpl > _superclassConstraints = const [];
7540+
75587541 MixinElementImpl (this .reference, this .firstFragment) {
75597542 reference.element = this ;
75607543 firstFragment.element = this ;
@@ -7589,16 +7572,31 @@ class MixinElementImpl extends InterfaceElementImpl implements MixinElement {
75897572 @override
75907573 ElementKind get kind => ElementKind .MIXIN ;
75917574
7575+ @override
7576+ set mixins (List <InterfaceType > mixins) {
7577+ throw StateError ('Attempt to set mixins for a mixin declaration.' );
7578+ }
7579+
75927580 @override
75937581 List <InterfaceTypeImpl > get superclassConstraints {
7594- return [for (var fragment in fragments) ...fragment.superclassConstraints];
7582+ _ensureReadResolution ();
7583+ return _superclassConstraints;
7584+ }
7585+
7586+ set superclassConstraints (List <InterfaceTypeImpl > value) {
7587+ _superclassConstraints = value;
75957588 }
75967589
75977590 /// Names of methods, getters, setters, and operators that this mixin
75987591 /// declaration super-invokes. For setters this includes the trailing "=".
75997592 /// The list will be empty if this class is not a mixin declaration.
76007593 List <String > get superInvokedNames => firstFragment.superInvokedNames;
76017594
7595+ @override
7596+ set supertype (InterfaceType ? supertype) {
7597+ throw StateError ('Attempt to set a supertype for a mixin declaration.' );
7598+ }
7599+
76027600 @override
76037601 T ? accept <T >(ElementVisitor2 <T > visitor) {
76047602 return visitor.visitMixinElement (this );
@@ -7645,8 +7643,6 @@ class MixinFragmentImpl extends InterfaceFragmentImpl
76457643 @override
76467644 late final MixinElementImpl element;
76477645
7648- List <InterfaceTypeImpl > _superclassConstraints = const [];
7649-
76507646 /// Names of methods, getters, setters, and operators that this mixin
76517647 /// declaration super-invokes. For setters this includes the trailing "=".
76527648 /// The list will be empty if this class is not a mixin declaration.
@@ -7659,11 +7655,6 @@ class MixinFragmentImpl extends InterfaceFragmentImpl
76597655 @override
76607656 List <InterfaceTypeImpl > get mixins => const [];
76617657
7662- @override
7663- set mixins (List <InterfaceType > mixins) {
7664- throw StateError ('Attempt to set mixins for a mixin declaration.' );
7665- }
7666-
76677658 @override
76687659 MixinFragmentImpl ? get nextFragment =>
76697660 super .nextFragment as MixinFragmentImpl ? ;
@@ -7674,22 +7665,12 @@ class MixinFragmentImpl extends InterfaceFragmentImpl
76747665
76757666 @override
76767667 List <InterfaceTypeImpl > get superclassConstraints {
7677- _ensureReadResolution ();
7678- return _superclassConstraints;
7679- }
7680-
7681- set superclassConstraints (List <InterfaceTypeImpl > superclassConstraints) {
7682- _superclassConstraints = superclassConstraints;
7668+ return element.superclassConstraints;
76837669 }
76847670
76857671 @override
76867672 InterfaceTypeImpl ? get supertype => null ;
76877673
7688- @override
7689- set supertype (InterfaceType ? supertype) {
7690- throw StateError ('Attempt to set a supertype for a mixin declaration.' );
7691- }
7692-
76937674 void addFragment (MixinFragmentImpl fragment) {
76947675 fragment.element = element;
76957676 fragment.previousFragment = this ;
0 commit comments