mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Styling.
This commit is contained in:
parent
7a467bbf07
commit
8cd5eed17d
@ -24,10 +24,9 @@
|
||||
#include <libsolidity/AST.h>
|
||||
#include <libsolidity/Types.h>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
namespace solidity
|
||||
{
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
|
||||
bool DeclarationContainer::registerDeclaration(Declaration const& _declaration, bool _invisible, bool _update)
|
||||
{
|
||||
@ -62,7 +61,7 @@ bool DeclarationContainer::registerDeclaration(Declaration const& _declaration,
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set<Declaration const*> DeclarationContainer::resolveName(ASTString const& _name, bool _recursive) const
|
||||
set<Declaration const*> DeclarationContainer::resolveName(ASTString const& _name, bool _recursive) const
|
||||
{
|
||||
solAssert(!_name.empty(), "Attempt to resolve empty name.");
|
||||
auto result = m_declarations.find(_name);
|
||||
@ -70,8 +69,5 @@ std::set<Declaration const*> DeclarationContainer::resolveName(ASTString const&
|
||||
return result->second;
|
||||
if (_recursive && m_enclosingContainer)
|
||||
return m_enclosingContainer->resolveName(_name, true);
|
||||
return std::set<Declaration const*>({});
|
||||
}
|
||||
|
||||
}
|
||||
return set<Declaration const*>({});
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace dev
|
||||
namespace solidity
|
||||
{
|
||||
|
||||
NameAndTypeResolver::NameAndTypeResolver(std::vector<Declaration const*> const& _globals)
|
||||
NameAndTypeResolver::NameAndTypeResolver(vector<Declaration const*> const& _globals)
|
||||
{
|
||||
for (Declaration const* declaration: _globals)
|
||||
m_scopes[nullptr].registerDeclaration(*declaration);
|
||||
@ -119,7 +119,7 @@ set<Declaration const*> NameAndTypeResolver::resolveName(ASTString const& _name,
|
||||
{
|
||||
auto iterator = m_scopes.find(_scope);
|
||||
if (iterator == end(m_scopes))
|
||||
return std::set<Declaration const*>({});
|
||||
return set<Declaration const*>({});
|
||||
return iterator->second.resolveName(_name, false);
|
||||
}
|
||||
|
||||
@ -415,11 +415,17 @@ bool ReferencesResolver::visit(UserDefinedTypeName& _typeName)
|
||||
{
|
||||
auto declarations = m_resolver.getNameFromCurrentScope(_typeName.getName());
|
||||
if (declarations.empty())
|
||||
BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_typeName.getLocation())
|
||||
<< errinfo_comment("Undeclared identifier."));
|
||||
BOOST_THROW_EXCEPTION(
|
||||
DeclarationError() <<
|
||||
errinfo_sourceLocation(_typeName.getLocation()) <<
|
||||
errinfo_comment("Undeclared identifier.")
|
||||
);
|
||||
else if (declarations.size() > 1)
|
||||
BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_typeName.getLocation())
|
||||
<< errinfo_comment("Duplicate identifier."));
|
||||
BOOST_THROW_EXCEPTION(
|
||||
DeclarationError() <<
|
||||
errinfo_sourceLocation(_typeName.getLocation()) <<
|
||||
errinfo_comment("Duplicate identifier.")
|
||||
);
|
||||
else
|
||||
_typeName.setReferencedDeclaration(**declarations.begin());
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user