diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index 55b8b1ca9..db39edb07 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -100,8 +100,13 @@ public: auto scanner = make_shared(charStream); if (!m_inputIsCodeBlock && scanner->currentToken() == Token::LBrace) + { m_inputIsCodeBlock = true; + if (!_objectPath.empty()) + throw runtime_error("Object path argument cannot be used. Input is a code block."); + } + shared_ptr object = parser.parse(scanner, false); if (!object || !errorReporter.errors().empty()) @@ -262,8 +267,14 @@ public: { if (!m_inputIsCodeBlock) cout << m_object->toString(&m_dialect) << endl; - else + else { + yulAssert( + m_object->subObjects.empty(), + "Unexpected subObjects found." + ); + cout << AsmPrinter{m_dialect}(*m_object->code) << endl; + } } void resetNameDispenser()