Elements. Move isSimplyBounded to elements.

Change-Id: I02eb9137b9a98c2effd5b4657f97a8415ab1a1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448223
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 38a7861..41286c5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -106,7 +106,7 @@
 // TODO(scheglov): Clean up the list of implicitly analyzed files.
 class AnalysisDriver {
   /// The version of data format, should be incremented on every format change.
-  static const int DATA_VERSION = 538;
+  static const int DATA_VERSION = 539;
 
   /// The number of exception contexts allowed to write. Once this field is
   /// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index de89006..dc5f033 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2403,9 +2403,6 @@
   }
 
   @override
-  bool get isSimplyBounded => true;
-
-  @override
   MetadataImpl get metadata {
     _ensureReadResolution();
     return super.metadata;
@@ -4019,7 +4016,11 @@
   @override
   @trackedIncludedInId
   bool get isSimplyBounded {
-    return _firstFragment.isSimplyBounded;
+    return hasModifier(Modifier.SIMPLY_BOUNDED);
+  }
+
+  set isSimplyBounded(bool value) {
+    setModifier(Modifier.SIMPLY_BOUNDED, value);
   }
 
   @override
@@ -4493,13 +4494,6 @@
     _getters = getters;
   }
 
-  /// If the element defines a type, indicates whether the type may safely
-  /// appear without explicit type parameters as the bounds of a type parameter
-  /// declaration.
-  ///
-  /// If the element does not define a type, returns `true`.
-  bool get isSimplyBounded;
-
   @override
   LibraryFragmentImpl get libraryFragment => enclosingUnit;
 
@@ -4733,12 +4727,6 @@
     return name == '_Enum' && library.isDartCore;
   }
 
-  set isSimplyBounded(bool value) {
-    for (var fragment in fragments) {
-      fragment.isSimplyBounded = value;
-    }
-  }
-
   @override
   @trackedIncludedInId
   List<InterfaceTypeImpl> get mixins {
@@ -5023,9 +5011,7 @@
   void _buildMixinAppConstructors() {}
 }
 
-@GenerateFragmentImpl(modifiers: _InterfaceFragmentImplModifiers.values)
 abstract class InterfaceFragmentImpl extends InstanceFragmentImpl
-    with _InterfaceFragmentImplMixin
     implements InterfaceFragment {
   List<ConstructorFragmentImpl> _constructors = _Sentinel.constructorFragment;
 
@@ -9615,12 +9601,13 @@
   }
 
   @override
-  bool get isSimplyBounded => _firstFragment.isSimplyBounded;
+  @trackedIncludedInId
+  bool get isSimplyBounded {
+    return hasModifier(Modifier.SIMPLY_BOUNDED);
+  }
 
   set isSimplyBounded(bool value) {
-    for (var fragment in fragments) {
-      fragment.isSimplyBounded = value;
-    }
+    setModifier(Modifier.SIMPLY_BOUNDED, value);
   }
 
   @override
@@ -9782,9 +9769,8 @@
 /// An element that represents [GenericTypeAlias].
 ///
 /// Clients may not extend, implement or mix-in this class.
-@GenerateFragmentImpl(modifiers: _TypeAliasFragmentImplModifiers.values)
 class TypeAliasFragmentImpl extends FragmentImpl
-    with DeferredResolutionReadingMixin, _TypeAliasFragmentImplMixin
+    with DeferredResolutionReadingMixin
     implements TypeAliasFragment {
   @override
   final String? name;
@@ -10327,8 +10313,6 @@
   isSynthetic,
 }
 
-enum _InterfaceFragmentImplModifiers { isSimplyBounded }
-
 enum _MixinFragmentImplModifiers { isBase }
 
 enum _NonParameterVariableFragmentImplModifiers { hasInitializer }
@@ -10363,8 +10347,6 @@
   static final List<LibraryImportImpl> libraryImport = List.unmodifiable([]);
 }
 
-enum _TypeAliasFragmentImplModifiers { isSimplyBounded }
-
 enum _VariableFragmentImplModifiers {
   /// Whether the variable element did not have an explicit type specified
   /// for it.
diff --git a/pkg/analyzer/lib/src/dart/element/element.g.dart b/pkg/analyzer/lib/src/dart/element/element.g.dart
index 63e9b6b..59a9b99 100644
--- a/pkg/analyzer/lib/src/dart/element/element.g.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.g.dart
@@ -243,20 +243,6 @@
   void setModifier(Modifier modifier, bool value);
 }
 
-mixin _InterfaceFragmentImplMixin {
-  bool get isSimplyBounded {
-    return hasModifier(Modifier.SIMPLY_BOUNDED);
-  }
-
-  set isSimplyBounded(bool value) {
-    setModifier(Modifier.SIMPLY_BOUNDED, value);
-  }
-
-  bool hasModifier(Modifier modifier);
-
-  void setModifier(Modifier modifier, bool value);
-}
-
 mixin _MixinFragmentImplMixin {
   bool get isBase {
     return hasModifier(Modifier.BASE);
@@ -285,20 +271,6 @@
   void setModifier(Modifier modifier, bool value);
 }
 
-mixin _TypeAliasFragmentImplMixin {
-  bool get isSimplyBounded {
-    return hasModifier(Modifier.SIMPLY_BOUNDED);
-  }
-
-  set isSimplyBounded(bool value) {
-    setModifier(Modifier.SIMPLY_BOUNDED, value);
-  }
-
-  bool hasModifier(Modifier modifier);
-
-  void setModifier(Modifier modifier, bool value);
-}
-
 mixin _VariableFragmentImplMixin {
   /// Whether the variable element did not have an explicit type specified
   /// for it.
diff --git a/pkg/analyzer/lib/src/summary2/bundle_reader.dart b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
index f2031d8..6bf439b 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
@@ -476,6 +476,7 @@
       var fragments = _readFragmentsById<EnumFragmentImpl>();
       var element = EnumElementImpl(reference, fragments.first);
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       // TODO(scheglov): consider reading lazily
       for (var fragment in element.fragments) {
@@ -562,6 +563,7 @@
       var fragments = _readFragmentsById<ExtensionFragmentImpl>();
       var element = ExtensionElementImpl(reference, fragments.first);
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       for (var fragment in element.fragments) {
         fragment.ensureReadMembers();
@@ -617,6 +619,7 @@
       var fragments = _readFragmentsById<ExtensionTypeFragmentImpl>();
       var element = ExtensionTypeElementImpl(reference, fragments.first);
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       element.hasRepresentationSelfReference = _reader.readBool();
       element.hasImplementsSelfReference = _reader.readBool();
@@ -688,6 +691,7 @@
         firstFragment: fragments.first,
       );
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       element.deferReadResolution(
         _createDeferredReadResolutionCallback((reader) {
@@ -1172,6 +1176,7 @@
       var fragments = _readFragmentsById<TopLevelFunctionFragmentImpl>();
       var element = TopLevelFunctionElementImpl(reference, fragments.first);
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       element.deferReadResolution(
         _createDeferredReadResolutionCallback((reader) {
@@ -1231,6 +1236,7 @@
       var fragments = _readFragmentsById<TopLevelVariableFragmentImpl>();
       var element = TopLevelVariableElementImpl(reference, fragments.first);
       element.linkFragments(fragments);
+      element.readModifiers(_reader);
 
       element.deferReadResolution(
         _createDeferredReadResolutionCallback((reader) {
@@ -1267,6 +1273,7 @@
       var reference = _readReference();
       var fragments = _readFragmentsById<TypeAliasFragmentImpl>();
       var element = TypeAliasElementImpl(reference, fragments.first);
+      element.readModifiers(_reader);
 
       element.deferReadResolution(
         _createDeferredReadResolutionCallback((reader) {
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
index 3da32bf..70fd15f 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -261,6 +261,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
 
       // TODO(scheglov): consider reading lazily
       _resolutionSink.withTypeParameters(element.typeParameters, () {
@@ -323,6 +324,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
 
       // TODO(scheglov): consider reading lazily
       _resolutionSink.withTypeParameters(element.typeParameters, () {
@@ -357,6 +359,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
 
       // TODO(fshcheglov): Put these separate flags into modifiers
       _sink.writeBool(element.hasRepresentationSelfReference);
@@ -407,6 +410,8 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
+
       _writeElementResolution(() {
         _resolutionSink.writeType(element.type);
       });
@@ -709,6 +714,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
 
       _writeElementResolution(() {
         _resolutionSink.withTypeParameters(element.typeParameters, () {
@@ -733,6 +739,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
       _writeElementResolution(() {
         _resolutionSink.writeType(element.type);
       });
@@ -750,6 +757,7 @@
     _sink.writeList(elements, (element) {
       _writeReference(element.reference);
       _writeFragments(element.fragments);
+      element.writeModifiers(_sink);
 
       _writeElementResolution(() {
         _resolutionSink.withTypeParameters(element.typeParameters, () {