mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add ErrorReporter::typeErrorConcatenateDescriptions
This commit is contained in:
parent
eb5bde95b3
commit
ca9cced4b2
@ -26,6 +26,9 @@
|
||||
|
||||
#include <liblangutil/Exceptions.h>
|
||||
#include <liblangutil/SourceLocation.h>
|
||||
#include <libdevcore/StringUtils.h>
|
||||
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace langutil
|
||||
{
|
||||
@ -87,6 +90,19 @@ public:
|
||||
|
||||
void typeError(SourceLocation const& _location, std::string const& _description);
|
||||
|
||||
template <typename... Strings>
|
||||
void typeErrorConcatenateDescriptions(SourceLocation const& _location, Strings const&... _descriptions)
|
||||
{
|
||||
std::initializer_list<std::string> const descs = {_descriptions...};
|
||||
solAssert(descs.size() > 0, "Need error descriptions!");
|
||||
|
||||
auto filterEmpty = boost::adaptors::filtered([](std::string const& _s) { return !_s.empty(); });
|
||||
|
||||
std::string errorStr = dev::joinHumanReadable(descs | filterEmpty);
|
||||
|
||||
error(Error::Type::TypeError, _location, errorStr);
|
||||
}
|
||||
|
||||
void fatalTypeError(SourceLocation const& _location, std::string const& _description);
|
||||
|
||||
void docstringParsingError(std::string const& _description);
|
||||
|
Loading…
Reference in New Issue
Block a user