aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-05-04 21:46:46 +0800
committerLiana Husikyan <liana@ethdev.com>2015-05-04 23:18:44 +0800
commitebaf3c48a64ce7bbd6643b1d115d1c59005d15ec (patch)
tree5ec4d1a40c99b769ce8127899f5b4031ea0430bc /NameAndTypeResolver.cpp
parent10c3d7655570277b78912b6ff14b5078fce1077a (diff)
downloaddexon-solidity-ebaf3c48a64ce7bbd6643b1d115d1c59005d15ec.tar.gz
dexon-solidity-ebaf3c48a64ce7bbd6643b1d115d1c59005d15ec.tar.zst
dexon-solidity-ebaf3c48a64ce7bbd6643b1d115d1c59005d15ec.zip
small fix
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index a81c8238..813e0452 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -357,25 +357,26 @@ void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaratio
{
SourceLocation firstDeclarationLocation;
SourceLocation secondDeclarationLocation;
+ Declaration const* conflictingDeclaration = m_scopes[m_currentScope].conflictingDeclaration(_declaration);
+ solAssert(conflictingDeclaration, "");
- if (_declaration.getLocation().start < m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation().start)
+ if (_declaration.getLocation().start < conflictingDeclaration->getLocation().start)
{
firstDeclarationLocation = _declaration.getLocation();
- secondDeclarationLocation = m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation();
+ secondDeclarationLocation = conflictingDeclaration->getLocation();
}
else
{
- firstDeclarationLocation = m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation();
+ firstDeclarationLocation = conflictingDeclaration->getLocation();
secondDeclarationLocation = _declaration.getLocation();
}
- solAssert(m_scopes[m_currentScope].conflictingDeclaration(_declaration), "");
- BOOST_THROW_EXCEPTION(DeclarationError()
- << errinfo_sourceLocation(secondDeclarationLocation)
- << errinfo_comment("Identifier already declared.")
- << errinfo_secondarySourceLocation(SecondarySourceLocation().append(
- "The previous declaration is here:",
- firstDeclarationLocation
- )));
+
+ BOOST_THROW_EXCEPTION(
+ DeclarationError() <<
+ errinfo_sourceLocation(secondDeclarationLocation) <<
+ errinfo_comment("Identifier already declared.") <<
+ errinfo_secondarySourceLocation(
+ SecondarySourceLocation().append("The previous declaration is here:", firstDeclarationLocation)));
}
_declaration.setScope(m_currentScope);
@@ -456,8 +457,11 @@ bool ReferencesResolver::visit(Identifier& _identifier)
{
auto declarations = m_resolver.getNameFromCurrentScope(_identifier.getName());
if (declarations.empty())
- BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_identifier.getLocation())
- << errinfo_comment("Undeclared identifier."));
+ BOOST_THROW_EXCEPTION(
+ DeclarationError() <<
+ errinfo_sourceLocation(_identifier.getLocation()) <<
+ errinfo_comment("Undeclared identifier.")
+ );
else if (declarations.size() == 1)
_identifier.setReferencedDeclaration(**declarations.begin(), m_currentContract);
else