Provide access to scoped structs.

This commit is contained in:
chriseth
2015-10-06 14:20:06 +02:00
parent bc609c55c0
commit bf5b387954
8 changed files with 72 additions and 21 deletions
+3 -10
View File
@@ -54,20 +54,13 @@ bool ReferencesResolver::visit(Return const& _return)
bool ReferencesResolver::visit(UserDefinedTypeName const& _typeName)
{
auto declarations = m_resolver.nameFromCurrentScope(_typeName.name());
if (declarations.empty())
Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath());
if (!declaration)
BOOST_THROW_EXCEPTION(
DeclarationError() <<
errinfo_sourceLocation(_typeName.location()) <<
errinfo_comment("Undeclared identifier.")
errinfo_comment("Identifier not found or not unique.")
);
else if (declarations.size() > 1)
BOOST_THROW_EXCEPTION(
DeclarationError() <<
errinfo_sourceLocation(_typeName.location()) <<
errinfo_comment("Duplicate identifier.")
);
Declaration const* declaration = *declarations.begin();
_typeName.annotation().referencedDeclaration = declaration;
return true;
}