[yul-phaser] Program: Output operator for ErrorList

- It does not seem universal enough to put it in liblangutil but in the scope of yul-phaser it's generic enough so I'm going to keep it together with Program.
This commit is contained in:
Kamil Śliwak 2020-02-28 03:25:00 +01:00
parent e5a49e2556
commit 9ef63a9789
2 changed files with 18 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <liblangutil/CharStream.h> #include <liblangutil/CharStream.h>
#include <liblangutil/ErrorReporter.h> #include <liblangutil/ErrorReporter.h>
#include <liblangutil/Exceptions.h> #include <liblangutil/Exceptions.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libyul/AsmAnalysis.h> #include <libyul/AsmAnalysis.h>
#include <libyul/AsmAnalysisInfo.h> #include <libyul/AsmAnalysisInfo.h>
@ -57,6 +58,16 @@ ostream& operator<<(ostream& _stream, Program const& _program);
} }
ostream& std::operator<<(ostream& _outputStream, ErrorList const& _errors)
{
SourceReferenceFormatter formatter(_outputStream);
for (auto const& error: _errors)
formatter.printErrorInformation(*error);
return _outputStream;
}
Program::Program(Program const& program): Program::Program(Program const& program):
m_ast(make_unique<Block>(get<Block>(ASTCopier{}(*program.m_ast)))), m_ast(make_unique<Block>(get<Block>(ASTCopier{}(*program.m_ast)))),
m_dialect{program.m_dialect}, m_dialect{program.m_dialect},

View File

@ -41,6 +41,13 @@ struct Dialect;
} }
namespace std
{
std::ostream& operator<<(std::ostream& _outputStream, solidity::langutil::ErrorList const& _errors);
}
namespace solidity::phaser namespace solidity::phaser
{ {