Build AST graph explicitly for simpler post-parsing passes
Puts all of AST parent-child dependencies into a graph.
This change also makes it able to not care about such case:
Type -> (non Type) -> Type (ex. Interface -> Method -> Type)
and to store only Type -> Type relations.
Test: hidl_test
Change-Id: Ic67d9833d9519d7bd6cbae603c556c5bd905167a
diff --git a/CompoundType.cpp b/CompoundType.cpp
index 976a8a4..2123602 100644
--- a/CompoundType.cpp
+++ b/CompoundType.cpp
@@ -37,20 +37,16 @@
mFields = fields;
}
-status_t CompoundType::evaluate() {
- for (auto* field : *mFields) {
- status_t err = (*field)->callForReference(&Type::evaluate);
- if (err != OK) return err;
+std::vector<Reference<Type>> CompoundType::getReferences() const {
+ std::vector<Reference<Type>> ret;
+ for (const auto* field : *mFields) {
+ ret.push_back(*field);
}
-
- return Scope::evaluate();
+ return ret;
}
status_t CompoundType::validate() const {
for (const auto* field : *mFields) {
- status_t err = (*field)->callForReference(&Type::validate);
- if (err != OK) return err;
-
const Type& type = field->type();
if (type.isBinder()