mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
AnalysisFramework.formatErrors(): Support colored output and error IDs
This commit is contained in:
parent
6f3a379557
commit
6c1bcb9a81
@ -141,17 +141,30 @@ ErrorList AnalysisFramework::expectError(std::string const& _source, bool _warni
|
|||||||
return sourceAndErrors.second;
|
return sourceAndErrors.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
string AnalysisFramework::formatErrors() const
|
string AnalysisFramework::formatErrors(
|
||||||
|
bool _colored,
|
||||||
|
bool _withErrorIds
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
string message;
|
string message;
|
||||||
for (auto const& error: compiler().errors())
|
for (auto const& error: compiler().errors())
|
||||||
message += formatError(*error);
|
message += formatError(*error, _colored, _withErrorIds);
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
string AnalysisFramework::formatError(Error const& _error) const
|
string AnalysisFramework::formatError(
|
||||||
|
Error const& _error,
|
||||||
|
bool _colored,
|
||||||
|
bool _withErrorIds
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return SourceReferenceFormatter::formatErrorInformation(_error, *m_compiler);
|
return SourceReferenceFormatter::formatExceptionInformation(
|
||||||
|
_error,
|
||||||
|
_error.type(),
|
||||||
|
*m_compiler,
|
||||||
|
_colored,
|
||||||
|
_withErrorIds
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ContractDefinition const* AnalysisFramework::retrieveContractByName(SourceUnit const& _source, string const& _name)
|
ContractDefinition const* AnalysisFramework::retrieveContractByName(SourceUnit const& _source, string const& _name)
|
||||||
|
@ -57,8 +57,15 @@ protected:
|
|||||||
bool success(std::string const& _source);
|
bool success(std::string const& _source);
|
||||||
langutil::ErrorList expectError(std::string const& _source, bool _warning = false, bool _allowMultiple = false);
|
langutil::ErrorList expectError(std::string const& _source, bool _warning = false, bool _allowMultiple = false);
|
||||||
|
|
||||||
std::string formatErrors() const;
|
std::string formatErrors(
|
||||||
std::string formatError(langutil::Error const& _error) const;
|
bool _colored = false,
|
||||||
|
bool _withErrorIds = false
|
||||||
|
) const;
|
||||||
|
std::string formatError(
|
||||||
|
langutil::Error const& _error,
|
||||||
|
bool _colored = false,
|
||||||
|
bool _withErrorIds = false
|
||||||
|
) const;
|
||||||
|
|
||||||
static ContractDefinition const* retrieveContractByName(SourceUnit const& _source, std::string const& _name);
|
static ContractDefinition const* retrieveContractByName(SourceUnit const& _source, std::string const& _name);
|
||||||
static FunctionTypePointer retrieveFunctionBySignature(
|
static FunctionTypePointer retrieveFunctionBySignature(
|
||||||
|
Loading…
Reference in New Issue
Block a user