mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reverse if and else body.
This commit is contained in:
parent
78a343d2ff
commit
da121c9a26
14
Compiler.cpp
14
Compiler.cpp
@ -377,12 +377,16 @@ bool Compiler::visit(IfStatement const& _ifStatement)
|
|||||||
StackHeightChecker checker(m_context);
|
StackHeightChecker checker(m_context);
|
||||||
CompilerContext::LocationSetter locationSetter(m_context, _ifStatement);
|
CompilerContext::LocationSetter locationSetter(m_context, _ifStatement);
|
||||||
compileExpression(_ifStatement.getCondition());
|
compileExpression(_ifStatement.getCondition());
|
||||||
eth::AssemblyItem trueTag = m_context.appendConditionalJump();
|
m_context << eth::Instruction::ISZERO;
|
||||||
if (_ifStatement.getFalseStatement())
|
eth::AssemblyItem falseTag = m_context.appendConditionalJump();
|
||||||
_ifStatement.getFalseStatement()->accept(*this);
|
eth::AssemblyItem endTag = falseTag;
|
||||||
eth::AssemblyItem endTag = m_context.appendJumpToNew();
|
|
||||||
m_context << trueTag;
|
|
||||||
_ifStatement.getTrueStatement().accept(*this);
|
_ifStatement.getTrueStatement().accept(*this);
|
||||||
|
if (_ifStatement.getFalseStatement())
|
||||||
|
{
|
||||||
|
endTag = m_context.appendJumpToNew();
|
||||||
|
m_context << falseTag;
|
||||||
|
_ifStatement.getFalseStatement()->accept(*this);
|
||||||
|
}
|
||||||
m_context << endTag;
|
m_context << endTag;
|
||||||
|
|
||||||
checker.check();
|
checker.check();
|
||||||
|
Loading…
Reference in New Issue
Block a user