Pretty closing type parameters.
Fixes: 171946195
Test: aidl_unittests
Change-Id: I60fb8b66b7c0f0451c180fd833a99aba97d840eb
diff --git a/aidl_language.h b/aidl_language.h
index 53616b7..675acd6 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -133,13 +133,19 @@
const std::vector<T>& GetTypeParameters() const { return *type_params_; }
bool CheckValid() const;
+ __attribute__((warn_unused_result)) bool SetTypeParameters(std::vector<T>* type_params) {
+ if (type_params_) return false;
+ type_params_.reset(type_params);
+ return true;
+ }
+
virtual const AidlNode& AsAidlNode() const = 0;
protected:
AidlParameterizable(const AidlParameterizable&);
private:
- const unique_ptr<std::vector<T>> type_params_;
+ unique_ptr<std::vector<T>> type_params_;
static_assert(std::is_same<T, unique_ptr<AidlTypeSpecifier>>::value ||
std::is_same<T, std::string>::value);
};
@@ -305,6 +311,12 @@
bool IsArray() const { return is_array_; }
+ __attribute__((warn_unused_result)) bool SetArray() {
+ if (is_array_) return false;
+ is_array_ = true;
+ return true;
+ }
+
// Resolve the base type name to a fully-qualified name. Return false if the
// resolution fails.
bool Resolve(const AidlTypenames& typenames);