diff options
author | Christian Parpart <christian@ethereum.org> | 2018-11-30 21:34:08 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-06 21:01:01 +0800 |
commit | 073b03d90c8f0648ba135f0b30d8e72fd871478f (patch) | |
tree | b38bf2ef623bb1ac85bf9ca929ba61f76c05bd0d /libsolidity/interface | |
parent | 6efe2a526691f42e83b11cf670ec3e7f51927b3e (diff) | |
download | dexon-solidity-073b03d90c8f0648ba135f0b30d8e72fd871478f.tar.gz dexon-solidity-073b03d90c8f0648ba135f0b30d8e72fd871478f.tar.zst dexon-solidity-073b03d90c8f0648ba135f0b30d8e72fd871478f.zip |
liblangutil: refactor SourceReferenceFormatter, splitting out retrieval and making use of new SourceLocation's CharStream knowledge
Diffstat (limited to 'libsolidity/interface')
-rw-r--r-- | libsolidity/interface/StandardCompiler.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 0eef50d2..862b6633 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -69,12 +69,11 @@ Json::Value formatErrorWithException( bool const& _warning, string const& _type, string const& _component, - string const& _message, - function<Scanner const&(string const&)> const& _scannerFromSourceName + string const& _message ) { string message; - string formattedMessage = SourceReferenceFormatter::formatExceptionInformation(_exception, _type, _scannerFromSourceName); + string formattedMessage = SourceReferenceFormatter::formatExceptionInformation(_exception, _type); // NOTE: the below is partially a copy from SourceReferenceFormatter SourceLocation const* location = boost::get_error_info<errinfo_sourceLocation>(_exception); @@ -433,8 +432,6 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) Json::Value outputSelection = settings.get("outputSelection", Json::Value()); m_compilerStack.setRequestedContractNames(requestedContractNames(outputSelection)); - auto scannerFromSourceName = [&](string const& _sourceName) -> Scanner const& { return m_compilerStack.scanner(_sourceName); }; - try { m_compilerStack.compile(); @@ -448,8 +445,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) err.type() == Error::Type::Warning, err.typeName(), "general", - "", - scannerFromSourceName + "" )); } } @@ -461,8 +457,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) false, _error.typeName(), "general", - "Uncaught error: ", - scannerFromSourceName + "Uncaught error: " )); } /// This should not be leaked from compile(). @@ -482,8 +477,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) false, "CompilerError", "general", - "Compiler error (" + _exception.lineInfo() + ")", - scannerFromSourceName + "Compiler error (" + _exception.lineInfo() + ")" )); } catch (InternalCompilerError const& _exception) @@ -493,8 +487,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) false, "InternalCompilerError", "general", - "Internal compiler error (" + _exception.lineInfo() + ")", - scannerFromSourceName + "Internal compiler error (" + _exception.lineInfo() + ")" )); } catch (UnimplementedFeatureError const& _exception) @@ -504,8 +497,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input) false, "UnimplementedFeatureError", "general", - "Unimplemented feature (" + _exception.lineInfo() + ")", - scannerFromSourceName + "Unimplemented feature (" + _exception.lineInfo() + ")" )); } catch (Exception const& _exception) |