mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Sol->Yul] Implement .length for storage arrays
This commit is contained in:
@@ -34,6 +34,7 @@ namespace solidity
|
||||
class VariableDeclaration;
|
||||
class IRGenerationContext;
|
||||
class Type;
|
||||
class ArrayType;
|
||||
|
||||
/**
|
||||
* Abstract class used to retrieve, delete and store data in LValues.
|
||||
@@ -107,6 +108,24 @@ private:
|
||||
boost::variant<std::string, unsigned> const m_offset;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reference to the "length" member of a dynamically-sized storage array. This is an LValue with special
|
||||
* semantics since assignments to it might reduce its length and thus the array's members have to be
|
||||
* deleted.
|
||||
*/
|
||||
class IRStorageArrayLength: public IRLValue
|
||||
{
|
||||
public:
|
||||
IRStorageArrayLength(IRGenerationContext& _context, std::string _slot, Type const& _type, ArrayType const& _arrayType);
|
||||
|
||||
std::string retrieveValue() const override;
|
||||
std::string storeValue(std::string const& _value, Type const& _type) const override;
|
||||
std::string setToZero() const override;
|
||||
|
||||
private:
|
||||
ArrayType const& m_arrayType;
|
||||
std::string const m_slot;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user