diff options
author | Christian <c@ethdev.com> | 2014-10-16 23:56:10 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-23 22:43:50 +0800 |
commit | 781d7fd5149f6e24d60cd0327841ca9f2fca23af (patch) | |
tree | 7b4d192d2de6377b34dcf5b3e72113fbb5819b0a /NameAndTypeResolver.cpp | |
parent | fd046d7c9088498fbb0bded6a8ca69554155f483 (diff) | |
download | dexon-solidity-781d7fd5149f6e24d60cd0327841ca9f2fca23af.tar.gz dexon-solidity-781d7fd5149f6e24d60cd0327841ca9f2fca23af.tar.zst dexon-solidity-781d7fd5149f6e24d60cd0327841ca9f2fca23af.zip |
Improved exceptions and reporting exceptions for command-line compiler.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r-- | NameAndTypeResolver.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp index 707b6ce1..8fe45281 100644 --- a/NameAndTypeResolver.cpp +++ b/NameAndTypeResolver.cpp @@ -137,7 +137,8 @@ void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaratio { BOOST_ASSERT(m_currentScope != nullptr); if (!m_currentScope->registerDeclaration(_declaration)) - BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_comment("Identifier already declared.")); + BOOST_THROW_EXCEPTION(DeclarationError(_declaration.getLocation(), "Identifier already declared.")); + //@todo the exception should also contain the location of the first declaration if (_opensScope) enterNewSubScope(_declaration); } @@ -175,11 +176,11 @@ bool ReferencesResolver::visit(UserDefinedTypeName& _typeName) { Declaration* declaration = m_resolver.getNameFromCurrentScope(_typeName.getName()); if (declaration == nullptr) - BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_comment("Undeclared identifier.")); + BOOST_THROW_EXCEPTION(DeclarationError(_typeName.getLocation(), "Undeclared identifier.")); StructDefinition* referencedStruct = dynamic_cast<StructDefinition*>(declaration); //@todo later, contracts are also valid types if (referencedStruct == nullptr) - BOOST_THROW_EXCEPTION(TypeError() << errinfo_comment("Identifier does not name a type name.")); + BOOST_THROW_EXCEPTION(TypeError(_typeName.getLocation(), "Identifier does not name a type name.")); _typeName.setReferencedStruct(*referencedStruct); return false; } @@ -188,7 +189,7 @@ bool ReferencesResolver::visit(Identifier& _identifier) { Declaration* declaration = m_resolver.getNameFromCurrentScope(_identifier.getName()); if (declaration == nullptr) - BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_comment("Undeclared identifier.")); + BOOST_THROW_EXCEPTION(DeclarationError(_identifier.getLocation(), "Undeclared identifier.")); _identifier.setReferencedDeclaration(*declaration); return false; } |