aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/ast/Types.cpp2
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp34
2 files changed, 36 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 7f5ec46a..eb56e8ae 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2529,6 +2529,7 @@ string FunctionType::richIdentifier() const
case Kind::AddMod: id += "addmod"; break;
case Kind::MulMod: id += "mulmod"; break;
case Kind::ArrayPush: id += "arraypush"; break;
+ case Kind::ArrayPop: id += "arraypop"; break;
case Kind::ByteArrayPush: id += "bytearraypush"; break;
case Kind::ObjectCreation: id += "objectcreation"; break;
case Kind::Assert: id += "assert"; break;
@@ -2683,6 +2684,7 @@ unsigned FunctionType::sizeOnStack() const
case Kind::BareDelegateCall:
case Kind::Internal:
case Kind::ArrayPush:
+ case Kind::ArrayPop:
case Kind::ByteArrayPush:
size = 1;
break;
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 91f59035..b53a9294 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5397,6 +5397,40 @@ BOOST_AUTO_TEST_CASE(byte_array_pop_copy_long)
));
}
+BOOST_AUTO_TEST_CASE(array_pop_isolated)
+{
+ char const* sourceCode = R"(
+ // This tests that the compiler knows the correct size of the function on the stack.
+ contract c {
+ uint[] data;
+ function test() public returns (uint x) {
+ x = 2;
+ data.pop;
+ x = 3;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("test()"), encodeArgs(3));
+}
+
+BOOST_AUTO_TEST_CASE(byte_array_pop_isolated)
+{
+ char const* sourceCode = R"(
+ // This tests that the compiler knows the correct size of the function on the stack.
+ contract c {
+ bytes data;
+ function test() public returns (uint x) {
+ x = 2;
+ data.pop;
+ x = 3;
+ }
+ }
+ )";
+ compileAndRun(sourceCode);
+ ABI_CHECK(callContractFunction("test()"), encodeArgs(3));
+}
+
BOOST_AUTO_TEST_CASE(external_array_args)
{
char const* sourceCode = R"(