Evaluate the type before checking array dimension type
AidlConstantValue final_type_ changes after calling EvaluatedType...
So evaluate the constant value before checking the type.
This allows for Type::REF and Type::BINARY to be used in array
dimensions.
Test: atest aidl_unittests
Bug: N/A
Change-Id: Ic00699e3e6095c57b814df3140bf29dbcd2fb8dd
diff --git a/aidl_const_expressions.cpp b/aidl_const_expressions.cpp
index aefd8a0..b3a1667 100644
--- a/aidl_const_expressions.cpp
+++ b/aidl_const_expressions.cpp
@@ -667,6 +667,14 @@
return true;
}
+bool AidlConstantValue::Evaluate() const {
+ if (CheckValid()) {
+ return evaluate();
+ } else {
+ return false;
+ }
+}
+
bool AidlConstantValue::evaluate() const {
if (is_evaluated_) {
return is_valid_;