mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test the removal of the result variable.
This commit is contained in:
parent
bf27e86984
commit
78945e81e4
@ -310,4 +310,34 @@ BOOST_AUTO_TEST_CASE(move_up_rightwards_arguments)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(pop_result)
|
||||||
|
{
|
||||||
|
// This tests that `pop(r)` is removed.
|
||||||
|
BOOST_CHECK_EQUAL(
|
||||||
|
fullInline(R"({
|
||||||
|
function f(a) -> x { let r := mul(a, a) x := add(r, r) }
|
||||||
|
pop(add(f(7), 2))
|
||||||
|
})", false),
|
||||||
|
format(R"({
|
||||||
|
{
|
||||||
|
let _1 := 2
|
||||||
|
let f_a := 7
|
||||||
|
let f_x
|
||||||
|
{
|
||||||
|
let f_r := mul(f_a, f_a)
|
||||||
|
f_x := add(f_r, f_r)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function f(a) -> x
|
||||||
|
{
|
||||||
|
let r := mul(a, a)
|
||||||
|
x := add(r, r)
|
||||||
|
}
|
||||||
|
})", false)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user