diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-12 19:05:20 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-13 04:37:06 +0800 |
commit | 0259459b21f1f907380ec1f692dda19f7b2388bb (patch) | |
tree | 47b45d9eefbf0f165c80d4c114a1f999ac3d6cd9 /libsolidity/analysis | |
parent | 8bb96eaaf533b17cd9c9109642455408f551348c (diff) | |
download | dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar.gz dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar.bz2 dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar.lz dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar.xz dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.tar.zst dexon-solidity-0259459b21f1f907380ec1f692dda19f7b2388bb.zip |
Limit each duplicate declaration error to 32 references
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 87750c6e..c54f4c87 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -164,10 +164,18 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con for (; it != functions[_contract.name()].end(); ++it) ssl.append("Another declaration is here:", (*it)->location()); + string msg = "More than one constructor defined."; + size_t occurrences = ssl.infos.size(); + if (occurrences > 32) + { + ssl.infos.resize(32); + msg += " Truncated from " + boost::lexical_cast<string>(occurrences) + " to the first 32 occurrences."; + } + m_errorReporter.declarationError( functions[_contract.name()].front()->location(), ssl, - "More than one constructor defined." + msg ); } for (auto const& it: functions) @@ -186,11 +194,21 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con } if (ssl.infos.size() > 0) + { + string msg = "Function with same name and arguments defined twice."; + size_t occurrences = ssl.infos.size(); + if (occurrences > 32) + { + ssl.infos.resize(32); + msg += " Truncated from " + boost::lexical_cast<string>(occurrences) + " to the first 32 occurrences."; + } + m_errorReporter.declarationError( overloads[i]->location(), ssl, - "Function with same name and arguments defined twice." + msg ); + } } } } |