Helper function for analysis.

This commit is contained in:
chriseth 2019-01-29 15:01:30 +01:00
parent dd5b43741c
commit 4f641e3732
2 changed files with 26 additions and 0 deletions

View File

@ -55,6 +55,26 @@ bool AsmAnalyzer::analyze(Block const& _block)
return (*this)(_block);
}
AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(
shared_ptr<Dialect> _dialect,
EVMVersion _evmVersion,
Block const& _ast
)
{
ErrorList errorList;
langutil::ErrorReporter errors(errorList);
yul::AsmAnalysisInfo analysisInfo;
bool success = yul::AsmAnalyzer(
analysisInfo,
errors,
_evmVersion,
Error::Type::SyntaxError,
_dialect
).analyze(_ast);
solAssert(success && errorList.empty(), "Invalid assembly/yul code.");
return analysisInfo;
}
bool AsmAnalyzer::operator()(Label const& _label)
{
solAssert(!_label.name.empty(), "");

View File

@ -72,6 +72,12 @@ public:
bool analyze(Block const& _block);
static AsmAnalysisInfo analyzeStrictAssertCorrect(
std::shared_ptr<Dialect> _dialect,
dev::solidity::EVMVersion _evmVersion,
Block const& _ast
);
bool operator()(Instruction const&);
bool operator()(Literal const& _literal);
bool operator()(Identifier const&);