mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
if input was code block, only print code
This commit is contained in:
parent
153e32896b
commit
da28f9f315
@ -132,6 +132,11 @@ public:
|
|||||||
ObjectParser parser(errorReporter, m_dialect);
|
ObjectParser parser(errorReporter, m_dialect);
|
||||||
|
|
||||||
auto scanner = make_shared<Scanner>(_charStream);
|
auto scanner = make_shared<Scanner>(_charStream);
|
||||||
|
|
||||||
|
if (!m_inputWasCodeBlock && scanner->currentToken() == Token::LBrace) {
|
||||||
|
m_inputWasCodeBlock = true;
|
||||||
|
}
|
||||||
|
|
||||||
auto content = parser.parse(scanner, false);
|
auto content = parser.parse(scanner, false);
|
||||||
|
|
||||||
if (content != nullptr)
|
if (content != nullptr)
|
||||||
@ -276,7 +281,15 @@ public:
|
|||||||
void parseAndPrint(string _source, string _objectPath)
|
void parseAndPrint(string _source, string _objectPath)
|
||||||
{
|
{
|
||||||
parse(_source, _objectPath);
|
parse(_source, _objectPath);
|
||||||
|
printObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void printObject()
|
||||||
|
{
|
||||||
|
if (!m_inputWasCodeBlock)
|
||||||
cout << m_object->toString(&m_dialect) << endl;
|
cout << m_object->toString(&m_dialect) << endl;
|
||||||
|
else
|
||||||
|
cout << AsmPrinter{m_dialect}(*m_object->code) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetNameDispenser()
|
void resetNameDispenser()
|
||||||
@ -358,12 +371,14 @@ public:
|
|||||||
cerr << boost::current_exception_diagnostic_information() << endl;
|
cerr << boost::current_exception_diagnostic_information() << endl;
|
||||||
}
|
}
|
||||||
cout << "----------------------" << endl;
|
cout << "----------------------" << endl;
|
||||||
cout << m_object->toString(&m_dialect) << endl;
|
printObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
shared_ptr<yul::Object> m_object;
|
shared_ptr<yul::Object> m_object;
|
||||||
|
bool m_inputWasCodeBlock;
|
||||||
|
|
||||||
Dialect const& m_dialect{EVMDialect::strictAssemblyForEVMObjects(EVMVersion{})};
|
Dialect const& m_dialect{EVMDialect::strictAssemblyForEVMObjects(EVMVersion{})};
|
||||||
set<YulString> const m_reservedIdentifiers = {};
|
set<YulString> const m_reservedIdentifiers = {};
|
||||||
shared_ptr<NameDispenser> m_nameDispenser = make_shared<NameDispenser>(
|
shared_ptr<NameDispenser> m_nameDispenser = make_shared<NameDispenser>(
|
||||||
|
Loading…
Reference in New Issue
Block a user