mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
UserDefinedValueType.storageBytes() is correctly set
Previously it returned 32 bytes for all types, which was wasteful. This commit changes it to return the storage bytes of the underlying type.
This commit is contained in:
@@ -1108,6 +1108,8 @@ public:
|
||||
bool leftAligned() const override { return underlyingType().leftAligned(); }
|
||||
bool canBeStored() const override { return underlyingType().canBeStored(); }
|
||||
u256 storageSize() const override { return underlyingType().storageSize(); }
|
||||
unsigned storageBytes() const override { return underlyingType().storageBytes(); }
|
||||
|
||||
bool isValueType() const override
|
||||
{
|
||||
solAssert(underlyingType().isValueType(), "");
|
||||
@@ -1119,6 +1121,25 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool containsNestedMapping() const override
|
||||
{
|
||||
solAssert(nameable(), "Called for a non nameable type.");
|
||||
solAssert(!underlyingType().containsNestedMapping(), "");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasSimpleZeroValueInMemory() const override
|
||||
{
|
||||
solAssert(underlyingType().hasSimpleZeroValueInMemory(), "");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dataStoredIn(DataLocation _loc) const override
|
||||
{
|
||||
solAssert(!underlyingType().dataStoredIn(_loc), "");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string toString(bool _short) const override;
|
||||
std::string canonicalName() const override { solAssert(false, ""); }
|
||||
std::string signatureInExternalFunction(bool) const override { solAssert(false, ""); }
|
||||
|
||||
Reference in New Issue
Block a user