diff options
author | chriseth <chris@ethereum.org> | 2018-04-17 05:03:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-17 05:03:49 +0800 |
commit | 4cb486ee993cadde5564fb6c611d2bcf4fc44414 (patch) | |
tree | 6b971913021037cf28141c38af97c7ecda77719f /libsolidity/interface/ErrorReporter.cpp | |
parent | dfe3193c7382c80f1814247a162663a97c3f5e67 (diff) | |
parent | b8431c5c4a6795db8c42a1a3389047658bb87301 (diff) | |
download | dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.gz dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.bz2 dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.lz dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.xz dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.tar.zst dexon-solidity-4cb486ee993cadde5564fb6c611d2bcf4fc44414.zip |
Merge pull request #3892 from ethereum/develop
Merge develop into release for 0.4.22
Diffstat (limited to 'libsolidity/interface/ErrorReporter.cpp')
-rw-r--r-- | libsolidity/interface/ErrorReporter.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libsolidity/interface/ErrorReporter.cpp b/libsolidity/interface/ErrorReporter.cpp index e6171756..368e25e0 100644 --- a/libsolidity/interface/ErrorReporter.cpp +++ b/libsolidity/interface/ErrorReporter.cpp @@ -61,6 +61,9 @@ void ErrorReporter::warning( void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, string const& _description) { + if (checkForExcessiveErrors(_type)) + return; + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -71,6 +74,9 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, st void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) { + if (checkForExcessiveErrors(_type)) + return; + auto err = make_shared<Error>(_type); *err << errinfo_sourceLocation(_location) << @@ -80,6 +86,37 @@ void ErrorReporter::error(Error::Type _type, SourceLocation const& _location, Se m_errorList.push_back(err); } +bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) +{ + if (_type == Error::Type::Warning) + { + m_warningCount++; + + if (m_warningCount == c_maxWarningsAllowed) + { + auto err = make_shared<Error>(Error::Type::Warning); + *err << errinfo_comment("There are more than 256 warnings. Ignoring the rest."); + m_errorList.push_back(err); + } + + if (m_warningCount >= c_maxWarningsAllowed) + return true; + } + else + { + m_errorCount++; + + if (m_errorCount > c_maxErrorsAllowed) + { + auto err = make_shared<Error>(Error::Type::Warning); + *err << errinfo_comment("There are more than 256 errors. Aborting."); + m_errorList.push_back(err); + BOOST_THROW_EXCEPTION(FatalError()); + } + } + + return false; +} void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description) { |