diff options
author | chriseth <chris@ethereum.org> | 2017-06-14 00:38:55 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-06-14 20:51:47 +0800 |
commit | 1b1f35762e7d761a6a97f825699972472ba44888 (patch) | |
tree | acedd6c37c3d39d30a20641e1279c3a408a0e8f1 /libsolidity/inlineasm | |
parent | 0b99c81f8536aa7888f26ac349ab233825350efc (diff) | |
download | dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar.gz dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar.bz2 dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar.lz dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar.xz dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.tar.zst dexon-solidity-1b1f35762e7d761a6a97f825699972472ba44888.zip |
Enforce function arguments when parsing functional instructions.
Diffstat (limited to 'libsolidity/inlineasm')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 68a9cb03..f9b073ba 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -174,6 +174,19 @@ assembly::Case Parser::parseCase() assembly::Statement Parser::parseExpression() { Statement operation = parseElementaryOperation(true); + if (operation.type() == typeid(Instruction)) + { + Instruction const& instr = boost::get<Instruction>(operation); + int args = instructionInfo(instr.instruction).args; + if (args > 0 && currentToken() != Token::LParen) + fatalParserError(string( + "Expected token \"(\" (\"" + + instructionNames().at(instr.instruction) + + "\" expects " + + boost::lexical_cast<string>(args) + + " arguments)" + )); + } if (currentToken() == Token::LParen) return parseCall(std::move(operation)); else |