aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-06 21:01:39 +0800
committerGitHub <noreply@github.com>2018-12-06 21:01:39 +0800
commit0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d (patch)
treea247b6ea5b9b305e60d9e4d403e805335415ba6f /libsolidity
parent1643d63e3af1b0e3aabac2f2ded3619505d0fa8c (diff)
parent073b03d90c8f0648ba135f0b30d8e72fd871478f (diff)
downloaddexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.tar.gz
dexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.tar.zst
dexon-solidity-0e8841005ca7bf93545a1bc76bd8fa0ed67cb32d.zip
Merge pull request #5554 from ethereum/cp-SourceReferenceFormatter-refactor
[2/3] Refactor SourceReferenceFormatter (split-out data extraction & make use of new SourceLocation knowledge)
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/CompilerContext.cpp3
-rw-r--r--libsolidity/interface/StandardCompiler.cpp22
2 files changed, 8 insertions, 17 deletions
diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp
index 5ccdac37..dac09c2e 100644
--- a/libsolidity/codegen/CompilerContext.cpp
+++ b/libsolidity/codegen/CompilerContext.cpp
@@ -386,8 +386,7 @@ void CompilerContext::appendInlineAssembly(
for (auto const& error: errorReporter.errors())
message += SourceReferenceFormatter::formatExceptionInformation(
*error,
- (error->type() == Error::Type::Warning) ? "Warning" : "Error",
- [&](string const&) -> Scanner const& { return *scanner; }
+ (error->type() == Error::Type::Warning) ? "Warning" : "Error"
);
message += "-------------------------------------------\n";
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)