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>"))
|
||||
<memEnd> := <abiEncode>(<memEnd><constructorParams>)
|
||||
<?saltSet>
|
||||
let <retVars> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
||||
let <address> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
||||
<!saltSet>
|
||||
let <retVars> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
||||
let <address> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
||||
</saltSet>
|
||||
<?isTryCall>
|
||||
let <success> := iszero(iszero(<address>))
|
||||
</isTryCall>
|
||||
<releaseTemporaryMemory>()
|
||||
)");
|
||||
t("memPos", m_context.newYulVariable());
|
||||
@ -1385,7 +1388,11 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
t("saltSet", functionType->saltSet());
|
||||
if (functionType->saltSet())
|
||||
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();
|
||||
|
||||
break;
|
||||
|
@ -12,6 +12,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=tangerineWhistle
|
||||
// ----
|
||||
// f() -> true
|
||||
|
@ -17,6 +17,7 @@ contract A {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=constantinople
|
||||
// ----
|
||||
// different_salt() -> true
|
||||
|
@ -26,6 +26,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// f() -> 0, 0, 96, 13, "test message."
|
||||
|
Loading…
Reference in New Issue
Block a user