mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use `leave
` in code generator.
This commit is contained in:
parent
f98925d8b6
commit
c30839888f
@ -132,10 +132,7 @@ string IRGenerator::generateFunction(FunctionDefinition const& _function)
|
||||
return m_context.functionCollector()->createFunction(functionName, [&]() {
|
||||
Whiskers t(R"(
|
||||
function <functionName>(<params>) <returns> {
|
||||
for { let return_flag := 1 } return_flag {} {
|
||||
<body>
|
||||
break
|
||||
}
|
||||
<body>
|
||||
}
|
||||
)");
|
||||
t("functionName", functionName);
|
||||
|
@ -296,7 +296,7 @@ void IRGeneratorForStatements::endVisit(Return const& _return)
|
||||
expressionAsType(*value, *types.front()) <<
|
||||
"\n";
|
||||
}
|
||||
m_code << "return_flag := 0\n" << "break\n";
|
||||
m_code << "leave\n";
|
||||
}
|
||||
|
||||
void IRGeneratorForStatements::endVisit(UnaryOperation const& _unaryOperation)
|
||||
@ -1349,7 +1349,7 @@ void IRGeneratorForStatements::generateLoop(
|
||||
m_code << "for {\n";
|
||||
if (_initExpression)
|
||||
_initExpression->accept(*this);
|
||||
m_code << "} return_flag {\n";
|
||||
m_code << "} 1 {\n";
|
||||
if (_loopExpression)
|
||||
_loopExpression->accept(*this);
|
||||
m_code << "}\n";
|
||||
@ -1373,8 +1373,6 @@ void IRGeneratorForStatements::generateLoop(
|
||||
_body.accept(*this);
|
||||
|
||||
m_code << "}\n";
|
||||
// Bubble up the return condition.
|
||||
m_code << "if iszero(return_flag) { break }\n";
|
||||
}
|
||||
|
||||
Type const& IRGeneratorForStatements::type(Expression const& _expression)
|
||||
|
Loading…
Reference in New Issue
Block a user