diff options
author | chriseth <c@ethdev.com> | 2017-01-26 00:29:06 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-01-26 00:29:06 +0800 |
commit | f62e269115822f791a0ad2e3699815f0725a0ef7 (patch) | |
tree | 2a96de1dc8f7a48a5eabbbe28571535ff56f27cf /libsolidity/inlineasm | |
parent | 946a63c26f0c03c31c6342acc65d099ffdc3691f (diff) | |
download | dexon-solidity-f62e269115822f791a0ad2e3699815f0725a0ef7.tar.gz dexon-solidity-f62e269115822f791a0ad2e3699815f0725a0ef7.tar.zst dexon-solidity-f62e269115822f791a0ad2e3699815f0725a0ef7.zip |
Disallow instructions in assignment.
Diffstat (limited to 'libsolidity/inlineasm')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 048d916d..bed90139 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -101,6 +101,8 @@ assembly::Statement Parser::parseStatement() { // functional assignment FunctionalAssignment funAss = createWithLocation<FunctionalAssignment>(identifier.location); + if (instructions().count(identifier.name)) + fatalParserError("Cannot use instruction names for identifier names."); m_scanner->next(); funAss.variableName = identifier; funAss.value.reset(new Statement(parseExpression())); @@ -156,8 +158,6 @@ std::map<string, dev::solidity::Instruction> const& Parser::instructions() assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher) { - map<string, dev::solidity::Instruction> const& s_instructions = instructions(); - Statement ret; switch (m_scanner->currentToken()) { @@ -176,9 +176,9 @@ assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher) else literal = m_scanner->currentLiteral(); // first search the set of instructions. - if (s_instructions.count(literal)) + if (instructions().count(literal)) { - dev::solidity::Instruction const& instr = s_instructions.at(literal); + dev::solidity::Instruction const& instr = instructions().at(literal); if (_onlySinglePusher) { InstructionInfo info = dev::solidity::instructionInfo(instr); @@ -210,11 +210,10 @@ assembly::Statement Parser::parseElementaryOperation(bool _onlySinglePusher) assembly::VariableDeclaration Parser::parseVariableDeclaration() { - map<string, dev::solidity::Instruction> const& s_instructions = instructions(); VariableDeclaration varDecl = createWithLocation<VariableDeclaration>(); expectToken(Token::Let); varDecl.name = m_scanner->currentLiteral(); - if (s_instructions.count(varDecl.name)) + if (instructions().count(varDecl.name)) fatalParserError("Cannot use instruction names for identifier names."); expectToken(Token::Identifier); expectToken(Token::Colon); |