mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix assignment of return variables from modifiers.
This commit is contained in:
parent
408bd5fa62
commit
8e208f23cb
@ -29,6 +29,9 @@ Bugfixes:
|
|||||||
* Yul IR Generator: Do not output empty switches/if-bodies for empty contracts.
|
* Yul IR Generator: Do not output empty switches/if-bodies for empty contracts.
|
||||||
|
|
||||||
|
|
||||||
|
Important Bugfixes in Experimental Features:
|
||||||
|
* Yul IR Generator: Changes to function return variables referenced in modifier invocation arguments were not properly forwarded if there was more than one return variable.
|
||||||
|
|
||||||
|
|
||||||
### 0.8.9 (2021-09-29)
|
### 0.8.9 (2021-09-29)
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ string IRGenerator::generateModifier(
|
|||||||
for (size_t i = 0; i < retParamsIn.size(); ++i)
|
for (size_t i = 0; i < retParamsIn.size(); ++i)
|
||||||
{
|
{
|
||||||
retParams.emplace_back(m_context.newYulVariable());
|
retParams.emplace_back(m_context.newYulVariable());
|
||||||
assignRetParams += retParams.back() + " := " + retParamsIn[i] + "\n";
|
assignRetParams += retParams.at(i) + " := " + retParamsIn.at(i) + "\n";
|
||||||
}
|
}
|
||||||
t("retParams", joinHumanReadable(retParams));
|
t("retParams", joinHumanReadable(retParams));
|
||||||
t("assignRetParams", assignRetParams);
|
t("assignRetParams", assignRetParams);
|
||||||
@ -529,7 +529,7 @@ string IRGenerator::generateFunctionWithModifierInner(FunctionDefinition const&
|
|||||||
for (size_t i = 0; i < retParams.size(); ++i)
|
for (size_t i = 0; i < retParams.size(); ++i)
|
||||||
{
|
{
|
||||||
retParamsIn.emplace_back(m_context.newYulVariable());
|
retParamsIn.emplace_back(m_context.newYulVariable());
|
||||||
assignRetParams += retParams.back() + " := " + retParamsIn[i] + "\n";
|
assignRetParams += retParams.at(i) + " := " + retParamsIn.at(i) + "\n";
|
||||||
}
|
}
|
||||||
vector<string> params = retParamsIn;
|
vector<string> params = retParamsIn;
|
||||||
for (auto const& varDecl: _function.parameters())
|
for (auto const& varDecl: _function.parameters())
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
contract C {
|
||||||
|
modifier m1(uint value) {
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
modifier m2(uint value) {
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f() public m1(x = 2) m2(y = 3) returns (uint x, uint y) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
|
// ----
|
||||||
|
// f() -> 2, 3
|
Loading…
Reference in New Issue
Block a user