diff options
author | bitshift <bitshift@posteo.org> | 2018-03-10 00:46:24 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-05-29 18:53:02 +0800 |
commit | e9dcfb0b624e5443942451fc865c154a2c5a73d7 (patch) | |
tree | 0c898c43537109fb786a979a981150e79806229a /libsolidity/ast | |
parent | 8f04c59046595216e9fffd93435055aa864fbd1f (diff) | |
download | dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar.gz dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar.bz2 dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar.lz dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar.xz dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.tar.zst dexon-solidity-e9dcfb0b624e5443942451fc865c154a2c5a73d7.zip |
Implements pop() for value type arrays.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 9 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 59668e1d..1c6003cd 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -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; } diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 7c6f179b..29c7db86 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -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() |