diff options
author | chriseth <chris@ethereum.org> | 2018-06-13 18:10:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-13 18:10:39 +0800 |
commit | 014bbc6c97a4abdf8eed5d0273d00c80308e355d (patch) | |
tree | ee1e676ce5b34efa6ac88967da846bb5fad1a16b | |
parent | 14a7c9f2b904d6bc01e2f65cf15347416bbdc815 (diff) | |
parent | 1d57d74e82ffc032da2ce3289d878f2eee29b1b2 (diff) | |
download | dexon-solidity-014bbc6c97a4abdf8eed5d0273d00c80308e355d.tar.gz dexon-solidity-014bbc6c97a4abdf8eed5d0273d00c80308e355d.tar.zst dexon-solidity-014bbc6c97a4abdf8eed5d0273d00c80308e355d.zip |
Merge pull request #4272 from ethereum/assert-break-continue
Fail if break/continue statements are used outside for/while loops in ContractCompiler
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index f195b416..81aba21e 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -749,16 +749,16 @@ bool ContractCompiler::visit(ForStatement const& _forStatement) bool ContractCompiler::visit(Continue const& _continueStatement) { CompilerContext::LocationSetter locationSetter(m_context, _continueStatement); - if (!m_continueTags.empty()) - m_context.appendJumpTo(m_continueTags.back()); + solAssert(!m_continueTags.empty(), ""); + m_context.appendJumpTo(m_continueTags.back()); return false; } bool ContractCompiler::visit(Break const& _breakStatement) { CompilerContext::LocationSetter locationSetter(m_context, _breakStatement); - if (!m_breakTags.empty()) - m_context.appendJumpTo(m_breakTags.back()); + solAssert(!m_breakTags.empty(), ""); + m_context.appendJumpTo(m_breakTags.back()); return false; } |