diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-05-04 20:46:52 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-05-04 20:47:38 +0800 |
commit | 0d47ed82b19f97d007def7fd4f158d5993763859 (patch) | |
tree | 326cbf1802c5d69a02271fa3ba7fffe334817fa2 | |
parent | 8b5fa857d7ce68573a763c03a1d064c30cbf9153 (diff) | |
download | dexon-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.cpp | 19 |
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); |