aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-05-01 00:06:04 +0800
committerLiana Husikyan <liana@ethdev.com>2015-05-04 20:47:38 +0800
commit8b5fa857d7ce68573a763c03a1d064c30cbf9153 (patch)
tree47dd0f6a17c035bdc0d0f3a39da2033cd1b5ee9c /NameAndTypeResolver.cpp
parentef26d9611120c5d3c36263a87e907a007e24c8d2 (diff)
downloaddexon-solidity-8b5fa857d7ce68573a763c03a1d064c30cbf9153.tar.gz
dexon-solidity-8b5fa857d7ce68573a763c03a1d064c30cbf9153.tar.zst
dexon-solidity-8b5fa857d7ce68573a763c03a1d064c30cbf9153.zip
created secondarySoureLocation error type
added additional information to error msgs
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index a286934a..56e81e37 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -354,8 +354,16 @@ void DeclarationRegistrationHelper::closeCurrentScope()
void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaration, bool _opensScope)
{
if (!m_scopes[m_currentScope].registerDeclaration(_declaration, !_declaration.isVisibleInContract()))
- BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_declaration.getLocation())
- << errinfo_comment("Identifier already declared."));
+ {
+ solAssert(m_scopes[m_currentScope].conflictingDeclaration(_declaration), "");
+ BOOST_THROW_EXCEPTION(DeclarationError()
+ << errinfo_sourceLocation(_declaration.getLocation())
+ << errinfo_comment("Identifier already declared.")
+ << errinfo_secondarySourceLocation(SecondarySourceLocation().append(
+ "The previous declaration is here:",
+ m_scopes[m_currentScope].conflictingDeclaration(_declaration)->getLocation())));
+ }
+
//@todo the exception should also contain the location of the first declaration
_declaration.setScope(m_currentScope);
if (_opensScope)