mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[test] AnalysisFramework's instance of CompilerStack to be lazily instanciated.
This commit is contained in:
committed by
chriseth
parent
94053c9a52
commit
862d798047
@@ -47,21 +47,21 @@ AnalysisFramework::parseAnalyseAndReturnError(
|
||||
bool _allowMultipleErrors
|
||||
)
|
||||
{
|
||||
m_compiler.reset();
|
||||
m_compiler.setSources({{"", _insertVersionPragma ? "pragma solidity >=0.0;\n" + _source : _source}});
|
||||
m_compiler.setEVMVersion(dev::test::Options::get().evmVersion());
|
||||
if (!m_compiler.parse())
|
||||
compiler().reset();
|
||||
compiler().setSources({{"", _insertVersionPragma ? "pragma solidity >=0.0;\n" + _source : _source}});
|
||||
compiler().setEVMVersion(dev::test::Options::get().evmVersion());
|
||||
if (!compiler().parse())
|
||||
{
|
||||
BOOST_FAIL("Parsing contract failed in analysis test suite:" + formatErrors());
|
||||
}
|
||||
|
||||
m_compiler.analyze();
|
||||
compiler().analyze();
|
||||
|
||||
ErrorList errors = filterErrors(m_compiler.errors(), _reportWarnings);
|
||||
ErrorList errors = filterErrors(compiler().errors(), _reportWarnings);
|
||||
if (errors.size() > 1 && !_allowMultipleErrors)
|
||||
BOOST_FAIL("Multiple errors found: " + formatErrors());
|
||||
|
||||
return make_pair(&m_compiler.ast(""), std::move(errors));
|
||||
return make_pair(&compiler().ast(""), std::move(errors));
|
||||
}
|
||||
|
||||
ErrorList AnalysisFramework::filterErrors(ErrorList const& _errorList, bool _includeWarnings) const
|
||||
@@ -118,7 +118,7 @@ ErrorList AnalysisFramework::expectError(std::string const& _source, bool _warni
|
||||
string AnalysisFramework::formatErrors() const
|
||||
{
|
||||
string message;
|
||||
for (auto const& error: m_compiler.errors())
|
||||
for (auto const& error: compiler().errors())
|
||||
message += formatError(*error);
|
||||
return message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user