mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Declared severityFromString function
This commit is contained in:
parent
85cdb29121
commit
e4ac0fcd96
@ -72,13 +72,17 @@ Error::Error(
|
||||
*this << util::errinfo_comment(_description);
|
||||
}
|
||||
|
||||
static std::optional<Severity> severityFromString(std::string _severity)
|
||||
static optional<Severity> severityFromString(string _severity)
|
||||
{
|
||||
boost::algorithm::to_lower(_severity);
|
||||
|
||||
_severity = boost::algorithm::trim_copy(_severity);
|
||||
|
||||
_severity[0] = toupper(_severity[0]);
|
||||
if (_severity == formatErrorSeverityLowercase(Severity::Error)) { return Severity::Error; }
|
||||
|
||||
return std::make_optional<std::string>(_severity).has_value() ? std::optional<std::string>(_severity) : std::nullopt;
|
||||
else if (_severity == formatErrorSeverityLowercase(Severity::Warning)) { return Severity::Warning; }
|
||||
|
||||
else if (_severity == formatErrorSeverityLowercase(Severity::Info)) { return Severity::Info; }
|
||||
|
||||
else return std::make_optional<Severity>(_severity).has_value() ? std::optional<Severity>(_severity) : std::nullopt;
|
||||
}
|
@ -205,6 +205,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static std::optional<Severity> severityFromString(std::string _severity);
|
||||
|
||||
static Severity errorSeverity(Type _type)
|
||||
{
|
||||
if (_type == Type::Info)
|
||||
|
Loading…
Reference in New Issue
Block a user