Redefine fqname in hidl-gen_y.yy
There is an inconsistency in hidl-gen_y.yy that fqname does not
mean an FQName object, but a Type object. Redefined fqname to create
an FQName object only, and rename the original fqname rule to fqtype.
This also propagates to AST::lookupType and Scope::lookupType to
take an FQName object instead of a plain string.
Test: `mma`
Test: `make hidl_test && adb sync && adb shell hidl_test`
Change-Id: I5d35192fa5fa9752b10bd9e7d339eadc5cdb78c0
diff --git a/AST.cpp b/AST.cpp
index aa27a76..224387d 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -175,8 +175,7 @@
return true;
}
-Type *AST::lookupType(const char *name) {
- FQName fqName(name);
+Type *AST::lookupType(const FQName &fqName) {
CHECK(fqName.isValid());
if (fqName.name().empty()) {
@@ -188,7 +187,7 @@
// This is just a plain identifier, resolve locally first if possible.
for (size_t i = mScopePath.size(); i-- > 0;) {
- Type *type = mScopePath[i]->lookupType(name);
+ Type *type = mScopePath[i]->lookupType(fqName);
if (type != NULL) {
// Resolve typeDefs to the target type.