Remove asm flavour.

This commit is contained in:
chriseth
2020-01-14 17:16:09 +01:00
parent 8865ec76dc
commit 123ea0a250
31 changed files with 173 additions and 126 deletions
+22 -1
View File
@@ -75,6 +75,27 @@ pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(strin
return make_pair(stack.parserResult()->code, stack.parserResult()->analysisInfo);
}
pair<shared_ptr<Block>, shared_ptr<yul::AsmAnalysisInfo>> yul::test::parse(
string const& _source,
Dialect const& _dialect,
ErrorList& _errors
)
{
ErrorReporter errorReporter(_errors);
shared_ptr<Scanner> scanner = make_shared<Scanner>(CharStream(_source, ""));
shared_ptr<Object> parserResult = yul::ObjectParser(errorReporter, _dialect).parse(scanner, false);
if (!parserResult)
return {};
if (!parserResult->code || !errorReporter.errors().empty())
return {};
shared_ptr<AsmAnalysisInfo> analysisInfo = make_shared<AsmAnalysisInfo>();
AsmAnalyzer analyzer(*analysisInfo, errorReporter, _dialect, {}, parserResult->dataNames());
// TODO this should be done recursively.
if (!analyzer.analyze(*parserResult->code) || !errorReporter.errors().empty())
return {};
return {std::move(parserResult->code), std::move(analysisInfo)};
}
yul::Block yul::test::disambiguate(string const& _source, bool _yul)
{
auto result = parse(_source, _yul);
@@ -83,5 +104,5 @@ yul::Block yul::test::disambiguate(string const& _source, bool _yul)
string yul::test::format(string const& _source, bool _yul)
{
return yul::AsmPrinter(_yul)(*parse(_source, _yul).first);
return yul::AsmPrinter()(*parse(_source, _yul).first);
}