diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-05-01 00:06:04 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-05-04 20:47:38 +0800 |
commit | 8b5fa857d7ce68573a763c03a1d064c30cbf9153 (patch) | |
tree | 47dd0f6a17c035bdc0d0f3a39da2033cd1b5ee9c /AST.cpp | |
parent | ef26d9611120c5d3c36263a87e907a007e24c8d2 (diff) | |
download | dexon-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 'AST.cpp')
-rw-r--r-- | AST.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -140,12 +140,22 @@ void ContractDefinition::checkDuplicateFunctions() const map<string, vector<FunctionDefinition const*>> functions; for (ASTPointer<FunctionDefinition> const& function: getDefinedFunctions()) functions[function->getName()].push_back(function.get()); + if (functions[getName()].size() > 1) + { + SecondarySourceLocation ssl; + auto it = functions[getName()].begin(); + ++it; + for(; it != functions[getName()].end(); ++it) + ssl.append("Another declaration is here:", (*it)->getLocation()); + BOOST_THROW_EXCEPTION( DeclarationError() << - errinfo_sourceLocation(getLocation()) << - errinfo_comment("More than one constructor defined.") + errinfo_sourceLocation(getConstructor()->getLocation()) << + errinfo_comment("More than one constructor defined.") << + errinfo_secondarySourceLocation(ssl) ); + } for (auto const& it: functions) { vector<FunctionDefinition const*> const& overloads = it.second; @@ -155,7 +165,9 @@ void ContractDefinition::checkDuplicateFunctions() const BOOST_THROW_EXCEPTION( DeclarationError() << errinfo_sourceLocation(overloads[j]->getLocation()) << - errinfo_comment("Function with same name and arguments already defined.") + errinfo_comment("Function with same name and arguments already defined.") << + errinfo_secondarySourceLocation(SecondarySourceLocation().append( + "The previous declaration is here:", overloads[i]->getLocation())) ); } } |