mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8004 from ethereum/fix-7960
abiv2 proto converter: Resize dynamic storage arrays via push
This commit is contained in:
commit
8385256bdc
@ -810,13 +810,16 @@ pair<string, string> AssignCheckVisitor::visit(ArrayType const& _type)
|
|||||||
length = getDynArrayLengthFromFuzz(_type.length(), counter());
|
length = getDynArrayLengthFromFuzz(_type.length(), counter());
|
||||||
lengthStr = to_string(length);
|
lengthStr = to_string(length);
|
||||||
if (m_stateVar)
|
if (m_stateVar)
|
||||||
resizeBuffer = assignAndCheckStringPair(
|
{
|
||||||
m_varName + ".length",
|
// Dynamic storage arrays are resized via the empty push() operation
|
||||||
m_paramName + ".length",
|
resizeBuffer.first = Whiskers(R"(<indentation>for (uint i = 0; i < <length>; i++) <arrayRef>.push();)")
|
||||||
lengthStr,
|
("indentation", indentation())
|
||||||
lengthStr,
|
("length", lengthStr)
|
||||||
DataType::VALUE
|
("arrayRef", m_varName)
|
||||||
);
|
.render() + "\n";
|
||||||
|
// Add a dynamic check on the resized length
|
||||||
|
resizeBuffer.second = checkString(m_paramName + ".length", lengthStr, DataType::VALUE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Resizing memory arrays via the new operator
|
// Resizing memory arrays via the new operator
|
||||||
|
Loading…
Reference in New Issue
Block a user