diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-26 08:49:32 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-26 10:20:34 +0800 |
commit | 05fcf1989ca619d197d22d3acab79b25ef7aa695 (patch) | |
tree | 2f06e29fca75919589aeeb29f822ece123c0d803 /libsolidity/inlineasm/AsmParser.cpp | |
parent | c64bd3378427b46b0ae37e5d39e8ca6586d697c2 (diff) | |
download | dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar.gz dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar.bz2 dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar.lz dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar.xz dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.tar.zst dexon-solidity-05fcf1989ca619d197d22d3acab79b25ef7aa695.zip |
Better error messages for invalid switch cases
Diffstat (limited to 'libsolidity/inlineasm/AsmParser.cpp')
-rw-r--r-- | libsolidity/inlineasm/AsmParser.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index 847735f4..ccc735f7 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -78,6 +78,10 @@ assembly::Statement Parser::parseStatement() _switch.cases.emplace_back(parseCase()); if (m_scanner->currentToken() == Token::Default) _switch.cases.emplace_back(parseCase()); + if (m_scanner->currentToken() == Token::Default) + fatalParserError("Only one default case allowed."); + else if (m_scanner->currentToken() == Token::Case) + fatalParserError("Case not allowed after default case."); if (_switch.cases.size() == 0) fatalParserError("Switch statement without any cases."); _switch.location.end = _switch.cases.back().body.location.end; |