Union has its associated (nested) tag enum
For each union, a `Tag` enum type is auto-generated.
union U {
int a;
String b;
}
is equivalent to
union U {
int a;
String b;
@Backing(type="int") enum Tag { a, b }
}
Bug: 218912230
Test: aidl_integration_test
Change-Id: Ic0cb8f4ad9a80fe9a301a97d4f061457fc99756a
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;