Better validation. Check that unions contain no fixup types and structs
contain no references to interfaces (hwBinders).
diff --git a/AST.cpp b/AST.cpp
index b746ebf..b085814 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -141,9 +141,14 @@
return mScopePath.top();
}
-void AST::addScopedType(const char *localName, NamedType *type) {
+bool AST::addScopedType(const char *localName, NamedType *type) {
// LOG(INFO) << "adding scoped type '" << localName << "'";
+ bool success = scope()->addType(localName, type);
+ if (!success) {
+ return false;
+ }
+
std::string path;
for (size_t i = 1; i < mScopePath.size(); ++i) {
path.append(mScopePath[i]->localName());
@@ -156,7 +161,7 @@
FQName fqName(mPackage.package(), mPackage.version(), path);
type->setFullName(fqName);
- scope()->addType(localName, type);
+ return true;
}
RefType *AST::lookupType(const char *name) {