aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-10-27 04:56:00 +0800
committerchriseth <chris@ethereum.org>2018-02-19 22:04:22 +0800
commitd7532f7b9c33cd191f400e9af34f4f06a4aef0fa (patch)
tree19b7d6768761c91cbb64bb6ff6a65940cfd88c66 /solc/CommandLineInterface.cpp
parent3f7e82d00ba6b0a9c1e7644b8613aa2126498893 (diff)
downloaddexon-solidity-d7532f7b9c33cd191f400e9af34f4f06a4aef0fa.tar.gz
dexon-solidity-d7532f7b9c33cd191f400e9af34f4f06a4aef0fa.tar.zst
dexon-solidity-d7532f7b9c33cd191f400e9af34f4f06a4aef0fa.zip
Convert static SourceReferenceFormatter functions to member ones
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index adcfee9c..8383afed 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -777,7 +777,10 @@ bool CommandLineInterface::processInput()
}
m_compiler.reset(new CompilerStack(fileReader));
+
auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compiler->scanner(_sourceName); };
+ SourceReferenceFormatter formatter(cerr, scannerFromSourceName);
+
try
{
if (m_args.count(g_argMetadataLiteral) > 0)
@@ -796,11 +799,9 @@ bool CommandLineInterface::processInput()
bool successful = m_compiler->compile();
for (auto const& error: m_compiler->errors())
- SourceReferenceFormatter::printExceptionInformation(
- cerr,
+ formatter.printExceptionInformation(
*error,
- (error->type() == Error::Type::Warning) ? "Warning" : "Error",
- scannerFromSourceName
+ (error->type() == Error::Type::Warning) ? "Warning" : "Error"
);
if (!successful)
@@ -808,7 +809,7 @@ bool CommandLineInterface::processInput()
}
catch (CompilerError const& _exception)
{
- SourceReferenceFormatter::printExceptionInformation(cerr, _exception, "Compiler error", scannerFromSourceName);
+ formatter.printExceptionInformation(_exception, "Compiler error");
return false;
}
catch (InternalCompilerError const& _exception)
@@ -828,7 +829,7 @@ bool CommandLineInterface::processInput()
if (_error.type() == Error::Type::DocstringParsingError)
cerr << "Documentation parsing error: " << *boost::get_error_info<errinfo_comment>(_error) << endl;
else
- SourceReferenceFormatter::printExceptionInformation(cerr, _error, _error.typeName(), scannerFromSourceName);
+ formatter.printExceptionInformation(_error, _error.typeName());
return false;
}
@@ -1086,15 +1087,17 @@ bool CommandLineInterface::assemble(
return false;
}
}
+
for (auto const& sourceAndStack: assemblyStacks)
{
auto const& stack = sourceAndStack.second;
+ auto scannerFromSourceName = [&](string const&) -> Scanner const& { return stack.scanner(); };
+ SourceReferenceFormatter formatter(cerr, scannerFromSourceName);
+
for (auto const& error: stack.errors())
- SourceReferenceFormatter::printExceptionInformation(
- cerr,
+ formatter.printExceptionInformation(
*error,
- (error->type() == Error::Type::Warning) ? "Warning" : "Error",
- [&](string const&) -> Scanner const& { return stack.scanner(); }
+ (error->type() == Error::Type::Warning) ? "Warning" : "Error"
);
if (!Error::containsOnlyWarnings(stack.errors()))
successful = false;