mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify AsmParser::parse(.) usage
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
#include <libyul/AsmAnalysis.h>
|
||||
#include <libyul/AsmAnalysisInfo.h>
|
||||
#include <libyul/Dialect.h>
|
||||
#include <liblangutil/Scanner.h>
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
@@ -56,7 +55,6 @@ shared_ptr<Block> parse(string const& _source, Dialect const& _dialect, ErrorRep
|
||||
try
|
||||
{
|
||||
auto stream = CharStream(_source, "");
|
||||
auto scanner = make_shared<Scanner>(stream);
|
||||
map<unsigned, shared_ptr<string const>> indicesToSourceNames;
|
||||
indicesToSourceNames[0] = make_shared<string const>("source0");
|
||||
indicesToSourceNames[1] = make_shared<string const>("source1");
|
||||
@@ -65,7 +63,7 @@ shared_ptr<Block> parse(string const& _source, Dialect const& _dialect, ErrorRep
|
||||
errorReporter,
|
||||
_dialect,
|
||||
move(indicesToSourceNames)
|
||||
).parse(scanner, false);
|
||||
).parse(stream);
|
||||
if (parserResult)
|
||||
{
|
||||
yul::AsmAnalysisInfo analysisInfo;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <libsolutil/CommonIO.h>
|
||||
#include <libsolutil/Exceptions.h>
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
#include <liblangutil/Scanner.h>
|
||||
#include <libyul/AsmAnalysis.h>
|
||||
#include <libyul/AsmAnalysisInfo.h>
|
||||
#include <libsolidity/parsing/Parser.h>
|
||||
@@ -45,7 +44,6 @@
|
||||
|
||||
#include <libsolidity/interface/OptimiserSettings.h>
|
||||
#include <liblangutil/CharStreamProvider.h>
|
||||
#include <liblangutil/Scanner.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
@@ -92,8 +90,7 @@ public:
|
||||
{
|
||||
ErrorReporter errorReporter(m_errors);
|
||||
m_charStream = make_shared<CharStream>(_input, "");
|
||||
m_scanner = make_shared<Scanner>(*m_charStream);
|
||||
m_ast = yul::Parser(errorReporter, m_dialect).parse(m_scanner, false);
|
||||
m_ast = yul::Parser(errorReporter, m_dialect).parse(*m_charStream);
|
||||
if (!m_ast || !errorReporter.errors().empty())
|
||||
{
|
||||
cerr << "Error parsing source." << endl;
|
||||
@@ -236,7 +233,6 @@ public:
|
||||
private:
|
||||
ErrorList m_errors;
|
||||
shared_ptr<CharStream> m_charStream;
|
||||
shared_ptr<Scanner> m_scanner;
|
||||
shared_ptr<yul::Block> m_ast;
|
||||
Dialect const& m_dialect{EVMDialect::strictAssemblyForEVMObjects(EVMVersion{})};
|
||||
shared_ptr<AsmAnalysisInfo> m_analysisInfo;
|
||||
|
||||
Reference in New Issue
Block a user