Implements pop() for value type arrays.

This commit is contained in:
bitshift
2018-05-29 12:53:02 +02:00
committed by Erik Kundt
parent 8f04c59046
commit e9dcfb0b62
6 changed files with 141 additions and 1 deletions
+9
View File
@@ -1689,6 +1689,7 @@ MemberList::MemberMap ArrayType::nativeMembers(ContractDefinition const*) const
{
members.push_back({"length", make_shared<IntegerType>(256)});
if (isDynamicallySized() && location() == DataLocation::Storage)
{
members.push_back({"push", make_shared<FunctionType>(
TypePointers{baseType()},
TypePointers{make_shared<IntegerType>(256)},
@@ -1696,6 +1697,14 @@ MemberList::MemberMap ArrayType::nativeMembers(ContractDefinition const*) const
strings{string()},
isByteArray() ? FunctionType::Kind::ByteArrayPush : FunctionType::Kind::ArrayPush
)});
members.push_back({"pop", make_shared<FunctionType>(
TypePointers{},
TypePointers{},
strings{string()},
strings{string()},
isByteArray() ? FunctionType::Kind::ByteArrayPop : FunctionType::Kind::ArrayPop
)});
}
}
return members;
}
+2
View File
@@ -914,7 +914,9 @@ public:
AddMod, ///< ADDMOD
MulMod, ///< MULMOD
ArrayPush, ///< .push() to a dynamically sized array in storage
ArrayPop, ///< .pop() from a dynamically sized array in storage
ByteArrayPush, ///< .push() to a dynamically sized byte array in storage
ByteArrayPop, ///< .pop() from a dynamically sized byte array in storage
ObjectCreation, ///< array creation using new
Assert, ///< assert()
Require, ///< require()