mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix Yul codegen for try with create.
This commit is contained in:
parent
be7b2c3725
commit
59da25056b
@ -1365,10 +1365,13 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
datacopy(<memPos>, dataoffset("<object>"), datasize("<object>"))
|
datacopy(<memPos>, dataoffset("<object>"), datasize("<object>"))
|
||||||
<memEnd> := <abiEncode>(<memEnd><constructorParams>)
|
<memEnd> := <abiEncode>(<memEnd><constructorParams>)
|
||||||
<?saltSet>
|
<?saltSet>
|
||||||
let <retVars> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
let <address> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
||||||
<!saltSet>
|
<!saltSet>
|
||||||
let <retVars> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
let <address> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
||||||
</saltSet>
|
</saltSet>
|
||||||
|
<?isTryCall>
|
||||||
|
let <success> := iszero(iszero(<address>))
|
||||||
|
</isTryCall>
|
||||||
<releaseTemporaryMemory>()
|
<releaseTemporaryMemory>()
|
||||||
)");
|
)");
|
||||||
t("memPos", m_context.newYulVariable());
|
t("memPos", m_context.newYulVariable());
|
||||||
@ -1385,7 +1388,11 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
t("saltSet", functionType->saltSet());
|
t("saltSet", functionType->saltSet());
|
||||||
if (functionType->saltSet())
|
if (functionType->saltSet())
|
||||||
t("salt", IRVariable(_functionCall.expression()).part("salt").name());
|
t("salt", IRVariable(_functionCall.expression()).part("salt").name());
|
||||||
t("retVars", IRVariable(_functionCall).commaSeparatedList());
|
solAssert(IRVariable(_functionCall).stackSlots().size() == 1, "");
|
||||||
|
t("address", IRVariable(_functionCall).commaSeparatedList());
|
||||||
|
t("isTryCall", _functionCall.annotation().tryCall);
|
||||||
|
if (_functionCall.annotation().tryCall)
|
||||||
|
t("success", IRNames::trySuccessConditionVariable(_functionCall));
|
||||||
m_code << t.render();
|
m_code << t.render();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -12,6 +12,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// EVMVersion: >=tangerineWhistle
|
// EVMVersion: >=tangerineWhistle
|
||||||
// ----
|
// ----
|
||||||
// f() -> true
|
// f() -> true
|
||||||
|
@ -17,6 +17,7 @@ contract A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// EVMVersion: >=constantinople
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// different_salt() -> true
|
// different_salt() -> true
|
||||||
|
@ -26,6 +26,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
// EVMVersion: >=byzantium
|
// EVMVersion: >=byzantium
|
||||||
// ----
|
// ----
|
||||||
// f() -> 0, 0, 96, 13, "test message."
|
// f() -> 0, 0, 96, 13, "test message."
|
||||||
|
Loading…
Reference in New Issue
Block a user