diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-24 21:33:10 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-26 10:20:34 +0800 |
commit | c64bd3378427b46b0ae37e5d39e8ca6586d697c2 (patch) | |
tree | 20ed5ed92e856db88a9d3c30dc3ca1d1ac477f3f /libsolidity/inlineasm/AsmParser.cpp | |
parent | d745dd6542d488432453035763211fdad78c3a06 (diff) | |
download | dexon-solidity-c64bd3378427b46b0ae37e5d39e8ca6586d697c2.tar.gz dexon-solidity-c64bd3378427b46b0ae37e5d39e8ca6586d697c2.tar.zst dexon-solidity-c64bd3378427b46b0ae37e5d39e8ca6586d697c2.zip |
Disallow instructions as a switch expression
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 537a39a1..847735f4 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -72,6 +72,8 @@ assembly::Statement Parser::parseStatement() assembly::Switch _switch = createWithLocation<assembly::Switch>(); m_scanner->next(); _switch.expression = make_shared<Statement>(parseExpression()); + if (_switch.expression->type() == typeid(assembly::Instruction)) + fatalParserError("Instructions are not supported as expressions for switch."); while (m_scanner->currentToken() == Token::Case) _switch.cases.emplace_back(parseCase()); if (m_scanner->currentToken() == Token::Default) |