aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-24 01:22:30 +0800
committerChristian <c@ethdev.com>2014-10-24 03:37:57 +0800
commit094ee44f721054518ff384aef7cde1afe649636d (patch)
tree4b6935c867fd01c70ea8385778c2017067ec4dd6 /NameAndTypeResolver.cpp
parent781d7fd5149f6e24d60cd0327841ca9f2fca23af (diff)
downloaddexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar.gz
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar.bz2
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar.lz
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar.xz
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.tar.zst
dexon-solidity-094ee44f721054518ff384aef7cde1afe649636d.zip
Use boost errinfo.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index 8fe45281..a5650272 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(_declaration.getLocation(), "Identifier already declared."));
+ BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_declaration.getLocation())
+ << errinfo_comment("Identifier already declared."));
//@todo the exception should also contain the location of the first declaration
if (_opensScope)
enterNewSubScope(_declaration);
@@ -176,11 +177,13 @@ bool ReferencesResolver::visit(UserDefinedTypeName& _typeName)
{
Declaration* declaration = m_resolver.getNameFromCurrentScope(_typeName.getName());
if (declaration == nullptr)
- BOOST_THROW_EXCEPTION(DeclarationError(_typeName.getLocation(), "Undeclared identifier."));
+ BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_typeName.getLocation())
+ << errinfo_comment("Undeclared identifier."));
StructDefinition* referencedStruct = dynamic_cast<StructDefinition*>(declaration);
//@todo later, contracts are also valid types
if (referencedStruct == nullptr)
- BOOST_THROW_EXCEPTION(TypeError(_typeName.getLocation(), "Identifier does not name a type name."));
+ BOOST_THROW_EXCEPTION(TypeError() << errinfo_sourceLocation(_typeName.getLocation())
+ << errinfo_comment("Identifier does not name a type name."));
_typeName.setReferencedStruct(*referencedStruct);
return false;
}
@@ -189,7 +192,8 @@ bool ReferencesResolver::visit(Identifier& _identifier)
{
Declaration* declaration = m_resolver.getNameFromCurrentScope(_identifier.getName());
if (declaration == nullptr)
- BOOST_THROW_EXCEPTION(DeclarationError(_identifier.getLocation(), "Undeclared identifier."));
+ BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_identifier.getLocation())
+ << errinfo_comment("Undeclared identifier."));
_identifier.setReferencedDeclaration(*declaration);
return false;
}