diff options
author | chriseth <chris@ethereum.org> | 2018-10-01 19:10:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 19:10:54 +0800 |
commit | a17d480fc299eb3c81340b2b660b3163f6ebc3e4 (patch) | |
tree | 2771839ff1563309aea9334991222eb480b0e269 /test/libjulia/Inliner.cpp | |
parent | ba68966ea1f47df2a862c15c6595e40e6723bbd5 (diff) | |
parent | d5cd02b8edb06699b1cc6c37e69694870a4c21dc (diff) | |
download | dexon-solidity-a17d480fc299eb3c81340b2b660b3163f6ebc3e4.tar.gz dexon-solidity-a17d480fc299eb3c81340b2b660b3163f6ebc3e4.tar.zst dexon-solidity-a17d480fc299eb3c81340b2b660b3163f6ebc3e4.zip |
Merge pull request #5075 from ethereum/fixInliner
[Yul] Fix inliner
Diffstat (limited to 'test/libjulia/Inliner.cpp')
-rw-r--r-- | test/libjulia/Inliner.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp index 43a7d757..d0ecd42f 100644 --- a/test/libjulia/Inliner.cpp +++ b/test/libjulia/Inliner.cpp @@ -342,5 +342,40 @@ BOOST_AUTO_TEST_CASE(pop_result) ); } +BOOST_AUTO_TEST_CASE(inside_condition) +{ + // This tests that breaking the expression inside the condition works properly. + BOOST_CHECK_EQUAL( + fullInline("{" + "if gt(f(mload(1)), mload(0)) {" + "sstore(0, 2)" + "}" + "function f(a) -> r {" + "a := mload(a)" + "r := add(a, calldatasize())" + "}" + "}", false), + format("{" + "{" + "let _1 := mload(0)" + "let f_a := mload(1)" + "let f_r" + "{" + "f_a := mload(f_a)" + "f_r := add(f_a, calldatasize())" + "}" + "if gt(f_r, _1)" + "{" + "sstore(0, 2)" + "}" + "}" + "function f(a) -> r" + "{" + "a := mload(a)" + "r := add(a, calldatasize())" + "}" + "}", false) + ); +} BOOST_AUTO_TEST_SUITE_END() |