diff options
author | Jooyung Han <jooyung@google.com> | 2022-02-27 00:20:46 +0900 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2022-03-15 05:47:04 +0000 |
commit | d875b4904bbe094728404ee2c9ed512eabcbcaed (patch) | |
tree | 231ee29c766738abbd6139d15760816c2c274a9f /aidl_language.h | |
parent | 9ab1a9ef674d125e64e7ce8ca0f6bd79bda00f4a (diff) | |
download | aidl-d875b4904bbe094728404ee2c9ed512eabcbcaed.tar.gz |
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
Diffstat (limited to 'aidl_language.h')
-rw-r--r-- | aidl_language.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/aidl_language.h b/aidl_language.h index f3c5829d..15ce4bb4 100644 --- a/aidl_language.h +++ b/aidl_language.h @@ -999,10 +999,6 @@ class AidlDefinedType : public AidlMember, public AidlScope { 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 @@ class AidlDefinedType : public AidlMember, public AidlScope { } } + // 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; |