diff options
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 7 | ||||
-rw-r--r-- | test/libsolidity/InlineAssembly.cpp | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 88a0afc1..306b07e6 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -265,10 +265,13 @@ assembly::Expression Parser::parseExpression() instructionNames().at(instr.instruction) + "\" not allowed in this context." ); + if (m_flavour != AsmFlavour::Loose && currentToken() != Token::LParen) + fatalParserError( + "Non-functional instructions are not allowed in this context." + ); // Enforce functional notation for instructions requiring multiple arguments. int args = instructionInfo(instr.instruction).args; - bool requireFunctionalNotation = (args > 0 || m_flavour != AsmFlavour::Loose); - if (requireFunctionalNotation && currentToken() != Token::LParen) + if (args > 0 && currentToken() != Token::LParen) fatalParserError(string( "Expected token \"(\" (\"" + instructionNames().at(instr.instruction) + diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 216e1422..b09eb261 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -480,11 +480,11 @@ BOOST_AUTO_TEST_CASE(no_opcodes_in_strict) { BOOST_CHECK(successParse("{ pop(callvalue) }")); BOOST_CHECK(successParse("{ callvalue pop }")); - CHECK_STRICT_ERROR("{ pop(callvalue) }", ParserError, "Instruction \"callvalue\" not allowed in this context"); + CHECK_STRICT_ERROR("{ pop(callvalue) }", ParserError, "Non-functional instructions are not allowed in this context."); CHECK_STRICT_ERROR("{ callvalue pop }", ParserError, "Call or assignment expected"); SUCCESS_STRICT("{ pop(callvalue()) }"); BOOST_CHECK(successParse("{ switch callvalue case 0 {} }")); - CHECK_STRICT_ERROR("{ switch callvalue case 0 {} }", ParserError, "Instruction \"callvalue\" not allowed in this context"); + CHECK_STRICT_ERROR("{ switch callvalue case 0 {} }", ParserError, "Non-functional instructions are not allowed in this context."); } BOOST_AUTO_TEST_CASE(no_labels_in_strict) |