mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4272 from ethereum/assert-break-continue
Fail if break/continue statements are used outside for/while loops in ContractCompiler
This commit is contained in:
commit
014bbc6c97
@ -749,16 +749,16 @@ bool ContractCompiler::visit(ForStatement const& _forStatement)
|
|||||||
bool ContractCompiler::visit(Continue const& _continueStatement)
|
bool ContractCompiler::visit(Continue const& _continueStatement)
|
||||||
{
|
{
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, _continueStatement);
|
CompilerContext::LocationSetter locationSetter(m_context, _continueStatement);
|
||||||
if (!m_continueTags.empty())
|
solAssert(!m_continueTags.empty(), "");
|
||||||
m_context.appendJumpTo(m_continueTags.back());
|
m_context.appendJumpTo(m_continueTags.back());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContractCompiler::visit(Break const& _breakStatement)
|
bool ContractCompiler::visit(Break const& _breakStatement)
|
||||||
{
|
{
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, _breakStatement);
|
CompilerContext::LocationSetter locationSetter(m_context, _breakStatement);
|
||||||
if (!m_breakTags.empty())
|
solAssert(!m_breakTags.empty(), "");
|
||||||
m_context.appendJumpTo(m_breakTags.back());
|
m_context.appendJumpTo(m_breakTags.back());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user