diff options
author | chriseth <chris@ethereum.org> | 2017-06-15 00:35:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-15 00:35:16 +0800 |
commit | fd5bf16101d514d77cf4c7c64de367ec398995a2 (patch) | |
tree | 747e33bfd3c8c8ccf189b3eb1d237f44b85fe131 /libsolidity/inlineasm | |
parent | d693822a6fce5d1c853e50f4c7758bc003542644 (diff) | |
parent | 98139ead42e8641f99eb98cbe7997493f03ae099 (diff) | |
download | dexon-solidity-fd5bf16101d514d77cf4c7c64de367ec398995a2.tar.gz dexon-solidity-fd5bf16101d514d77cf4c7c64de367ec398995a2.tar.zst dexon-solidity-fd5bf16101d514d77cf4c7c64de367ec398995a2.zip |
Merge pull request #2384 from ethereum/parseFunctionalInstructions
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 |