Revert "Revert "Union has its associated (nested) tag enum""

This reverts commit a15ba2ad79c51a3ebd97bf857dac3de68ee9e150.

Reason for revert: aosp/2026184 fixed the issue.

Change-Id: Ie5b5f18e90cfe74c801eee5b00bc6868bdf93f41
diff --git a/aidl_language.h b/aidl_language.h
index f3c5829..15ce4bb 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -999,10 +999,6 @@
     return constants_;
   }
   const std::vector<std::unique_ptr<AidlMethod>>& GetMethods() const { return methods_; }
-  void AddMethod(std::unique_ptr<AidlMethod> method) {
-    members_.push_back(method.get());
-    methods_.push_back(std::move(method));
-  }
   const std::vector<const AidlMember*>& GetMembers() const { return members_; }
   void TraverseChildren(std::function<void(const AidlNode&)> traverse) const override {
     AidlAnnotatable::TraverseChildren(traverse);
@@ -1011,6 +1007,17 @@
     }
   }
 
+  // Modifiers
+  void AddMethod(std::unique_ptr<AidlMethod> method) {
+    members_.push_back(method.get());
+    methods_.push_back(std::move(method));
+  }
+  void AddType(std::unique_ptr<AidlDefinedType> type) {
+    type->SetEnclosingScope(this);
+    members_.push_back(type.get());
+    types_.push_back(std::move(type));
+  }
+
  protected:
   // utility for subclasses with getter names
   bool CheckValidForGetterNames() const;