diff options
author | chriseth <chris@ethereum.org> | 2018-12-20 01:06:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-20 01:06:13 +0800 |
commit | 1df8f40cd2fd7b47698d847907b8ca7b47eb488d (patch) | |
tree | 5ed5816fe2d1a8a207e750d39884aca7957c8289 /liblangutil/SourceReferenceFormatter.h | |
parent | c8a2cb62832afb2dc09ccee6fd42c1516dfdb981 (diff) | |
parent | ddf54b21d1d002903624f61173ab4af197f50053 (diff) | |
download | dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar.gz dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar.bz2 dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar.lz dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar.xz dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.tar.zst dexon-solidity-1df8f40cd2fd7b47698d847907b8ca7b47eb488d.zip |
Merge pull request #5697 from ethereum/develop
Merge develop into release for 0.5.2
Diffstat (limited to 'liblangutil/SourceReferenceFormatter.h')
-rw-r--r-- | liblangutil/SourceReferenceFormatter.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/liblangutil/SourceReferenceFormatter.h b/liblangutil/SourceReferenceFormatter.h index 0ef3ca00..9f05f430 100644 --- a/liblangutil/SourceReferenceFormatter.h +++ b/liblangutil/SourceReferenceFormatter.h @@ -25,6 +25,7 @@ #include <ostream> #include <sstream> #include <functional> +#include <liblangutil/SourceReferenceExtractor.h> namespace dev { @@ -39,38 +40,33 @@ class Scanner; class SourceReferenceFormatter { public: - using ScannerFromSourceNameFun = std::function<langutil::Scanner const&(std::string const&)>; - - explicit SourceReferenceFormatter( - std::ostream& _stream, - ScannerFromSourceNameFun _scannerFromSourceName - ): - m_stream(_stream), - m_scannerFromSourceName(std::move(_scannerFromSourceName)) + explicit SourceReferenceFormatter(std::ostream& _stream): + m_stream(_stream) {} /// Prints source location if it is given. - void printSourceLocation(langutil::SourceLocation const* _location); - void printExceptionInformation(dev::Exception const& _exception, std::string const& _name); + void printSourceLocation(SourceLocation const* _location); + void printSourceLocation(SourceReference const& _ref); + void printExceptionInformation(dev::Exception const& _error, std::string const& _category); + void printExceptionInformation(SourceReferenceExtractor::Message const& _msg); static std::string formatExceptionInformation( dev::Exception const& _exception, - std::string const& _name, - ScannerFromSourceNameFun const& _scannerFromSourceName + std::string const& _name ) { std::ostringstream errorOutput; - SourceReferenceFormatter formatter(errorOutput, _scannerFromSourceName); + SourceReferenceFormatter formatter(errorOutput); formatter.printExceptionInformation(_exception, _name); return errorOutput.str(); } + private: /// Prints source name if location is given. - void printSourceName(langutil::SourceLocation const* _location); + void printSourceName(SourceReference const& _ref); std::ostream& m_stream; - ScannerFromSourceNameFun m_scannerFromSourceName; }; } |