aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-05-04 20:46:52 +0800
committerLiana Husikyan <liana@ethdev.com>2015-05-04 20:47:38 +0800
commit0d47ed82b19f97d007def7fd4f158d5993763859 (patch)
tree326cbf1802c5d69a02271fa3ba7fffe334817fa2
parent8b5fa857d7ce68573a763c03a1d064c30cbf9153 (diff)
downloaddexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar.gz
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar.bz2
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar.lz
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar.xz
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.tar.zst
dexon-solidity-0d47ed82b19f97d007def7fd4f158d5993763859.zip
fixed the order of error msgs
-rw-r--r--NameAndTypeResolver.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index 56e81e37..a81c8238 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -355,16 +355,29 @@ void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaratio
{
if (!m_scopes[m_currentScope].registerDeclaration(_declaration, !_declaration.isVisibleInContract()))
{
+ SourceLocation firstDeclarationLocation;
+ SourceLocation secondDeclarationLocation;
+
+ if (_declaration.getLocation().start < m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation().start)
+ {
+ firstDeclarationLocation = _declaration.getLocation();
+ secondDeclarationLocation = m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation();
+ }
+ else
+ {
+ firstDeclarationLocation = m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation();
+ secondDeclarationLocation = _declaration.getLocation();
+ }
solAssert(m_scopes[m_currentScope].conflictingDeclaration(_declaration), "");
BOOST_THROW_EXCEPTION(DeclarationError()
- << errinfo_sourceLocation(_declaration.getLocation())
+ << errinfo_sourceLocation(secondDeclarationLocation)
<< errinfo_comment("Identifier already declared.")
<< errinfo_secondarySourceLocation(SecondarySourceLocation().append(
"The previous declaration is here:",
- m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation())));
+ firstDeclarationLocation
+ )));
}
- //@todo the exception should also contain the location of the first declaration
_declaration.setScope(m_currentScope);
if (_opensScope)
enterNewSubScope(_declaration);