Rename to HasMacroGenerationData.

R=brianwilkerson@google.com

Change-Id: I10c5f2900366ce2614e51c83be5f9e0138f279a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208144
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 9bb4ba7..f362f93 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1404,7 +1404,7 @@
 /// A concrete implementation of a [ConstructorElement].
 class ConstructorElementImpl extends ExecutableElementImpl
     with ConstructorElementMixin
-    implements ConstructorElement, HasElementMacro {
+    implements ConstructorElement, HasMacroGenerationData {
   /// The constructor to which this constructor is redirecting.
   ConstructorElement? _redirectedConstructor;
 
@@ -1413,7 +1413,7 @@
   List<ConstructorInitializer> _constantInitializers = const [];
 
   @override
-  ElementMacro? macro;
+  MacroGenerationData? macro;
 
   @override
   int? periodOffset;
@@ -2707,33 +2707,6 @@
   }
 }
 
-/// Information about a macro-produced [Element].
-class ElementMacro {
-  /// The sequential id of this macro-produced element, for an element created
-  /// for a declaration that was macro-generated later this value is greater.
-  ///
-  /// This is different from [ElementImpl.id], which is also incrementing,
-  /// but shows the order in which elements were built from declarations,
-  /// not the order of declarations, and we process all field declarations
-  /// before method declarations.
-  final int id;
-
-  /// The code that was produced by the macro. It is used to compose full
-  /// code of a unit to display to the user, so that new declarations are
-  /// added to the unit or existing classes.
-  ///
-  /// When a class is generated, its code might have some members, or might
-  /// be empty, and new elements might be macro-generated into it.
-  final String code;
-
-  /// When we build elements from macro-produced code, we remember informative
-  /// data, such as offsets - to store it into bytes. This field is set to
-  /// an empty list when reading from bytes.
-  final Uint8List informative;
-
-  ElementMacro(this.id, this.code, this.informative);
-}
-
 /// An [AbstractClassElementImpl] which is an enum.
 class EnumElementImpl extends AbstractClassElementImpl {
   ElementLinkedData? linkedData;
@@ -3500,10 +3473,10 @@
 }
 
 /// This interface is implemented by [Element]s that can be added by macros.
-abstract class HasElementMacro {
+abstract class HasMacroGenerationData {
   /// If this element was added by a macro, the code of a declaration that
   /// was produced by the macro.
-  ElementMacro? macro;
+  MacroGenerationData? macro;
 }
 
 /// A concrete implementation of a [HideElementCombinator].
@@ -4123,9 +4096,36 @@
       visitor.visitLocalVariableElement(this);
 }
 
+/// Information about a macro-produced [Element].
+class MacroGenerationData {
+  /// The sequential id of this macro-produced element, for an element created
+  /// for a declaration that was macro-generated later this value is greater.
+  ///
+  /// This is different from [ElementImpl.id], which is also incrementing,
+  /// but shows the order in which elements were built from declarations,
+  /// not the order of declarations, and we process all field declarations
+  /// before method declarations.
+  final int id;
+
+  /// The code that was produced by the macro. It is used to compose full
+  /// code of a unit to display to the user, so that new declarations are
+  /// added to the unit or existing classes.
+  ///
+  /// When a class is generated, its code might have some members, or might
+  /// be empty, and new elements might be macro-generated into it.
+  final String code;
+
+  /// When we build elements from macro-produced code, we remember informative
+  /// data, such as offsets - to store it into bytes. This field is set to
+  /// an empty list when reading from bytes.
+  final Uint8List informative;
+
+  MacroGenerationData(this.id, this.code, this.informative);
+}
+
 /// A concrete implementation of a [MethodElement].
 class MethodElementImpl extends ExecutableElementImpl
-    implements MethodElement, HasElementMacro {
+    implements MethodElement, HasMacroGenerationData {
   /// Is `true` if this method is `operator==`, and there is no explicit
   /// type specified for its formal parameter, in this method or in any
   /// overridden methods other than the one declared in `Object`.
@@ -4136,7 +4136,7 @@
   TopLevelInferenceError? typeInferenceError;
 
   @override
-  ElementMacro? macro;
+  MacroGenerationData? macro;
 
   /// Initialize a newly created method element to have the given [name] at the
   /// given [offset].
@@ -4941,13 +4941,13 @@
 
 /// A concrete implementation of a [PropertyAccessorElement].
 class PropertyAccessorElementImpl extends ExecutableElementImpl
-    implements PropertyAccessorElement, HasElementMacro {
+    implements PropertyAccessorElement, HasMacroGenerationData {
   /// The variable associated with this accessor.
   @override
   late PropertyInducingElement variable;
 
   @override
-  ElementMacro? macro;
+  MacroGenerationData? macro;
 
   /// Initialize a newly created property accessor element to have the given
   /// [name] and [offset].
diff --git a/pkg/analyzer/lib/src/macro/impl/macro.dart b/pkg/analyzer/lib/src/macro/impl/macro.dart
index ddb1a2b..73e10f7 100644
--- a/pkg/analyzer/lib/src/macro/impl/macro.dart
+++ b/pkg/analyzer/lib/src/macro/impl/macro.dart
@@ -74,9 +74,9 @@
       var node = entry.key;
       if (node is ast.Declaration) {
         var element = node.declaredElement;
-        if (element is HasElementMacro) {
+        if (element is HasMacroGenerationData) {
           var collectedDeclaration = entry.value;
-          (element as HasElementMacro).macro = ElementMacro(
+          (element as HasMacroGenerationData).macro = MacroGenerationData(
             collectedDeclaration.id,
             collectedDeclaration.declaration.code,
             collectedDeclaration.informative,
diff --git a/pkg/analyzer/lib/src/summary2/bundle_reader.dart b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
index a2b337b..51a33b6 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
@@ -853,9 +853,9 @@
     return LibraryLanguageVersion(package: package, override: override);
   }
 
-  void _readMacro(Element element, HasElementMacro hasMacro) {
+  void _readMacro(Element element, HasMacroGenerationData hasMacro) {
     if (_reader.readBool()) {
-      hasMacro.macro = ElementMacro(
+      hasMacro.macro = MacroGenerationData(
         _reader.readUInt30(),
         _reader.readStringUtf8(),
         Uint8List(0),
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
index 1878a80..5fd0bf8 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -281,7 +281,7 @@
     }
   }
 
-  void _writeMacro(ElementMacro? macro) {
+  void _writeMacro(MacroGenerationData? macro) {
     _sink.writeBool(macro != null);
     if (macro != null) {
       _sink.writeUInt30(macro.id);
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart
index 471c0c7..f8366c5 100644
--- a/pkg/analyzer/test/src/summary/element_text.dart
+++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -531,8 +531,8 @@
   }
 
   void _writeMacro(Element e) {
-    if (e is HasElementMacro) {
-      var macro = (e as HasElementMacro).macro;
+    if (e is HasMacroGenerationData) {
+      var macro = (e as HasMacroGenerationData).macro;
       if (macro != null) {
         _writelnWithIndent('macro');
         _withIndent(() {