diff options
author | chriseth <c@ethdev.com> | 2016-11-11 18:41:50 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:18 +0800 |
commit | e51f852504556f952ae1350c070409e3c4981cc0 (patch) | |
tree | 245a5605753ceca004513945a88f33fbc8fed81b /test | |
parent | e543bd34c0b4884b5a27555f698f50af6a1c0b81 (diff) | |
download | dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar.gz dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar.bz2 dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar.lz dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar.xz dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.tar.zst dexon-solidity-e51f852504556f952ae1350c070409e3c4981cc0.zip |
Converted sub assembly to smart pointer.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 2 | ||||
-rw-r--r-- | test/libsolidity/SolidityOptimizer.cpp | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 8f49b9c4..c01d11d2 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -7757,7 +7757,7 @@ BOOST_AUTO_TEST_CASE(store_function_in_constructor) { char const* sourceCode = R"( contract C { - uint result_in_constructor; + uint public result_in_constructor; function (uint) internal returns (uint) x; function C () { x = double; diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 562b7859..976976b2 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -1238,6 +1238,24 @@ BOOST_AUTO_TEST_CASE(inconsistency) compareVersions("trigger()"); } +BOOST_AUTO_TEST_CASE(dead_code_elimination_across_assemblies) +{ + // This tests that a runtime-function that is stored in storage in the constructor + // is not removed as part of dead code elimination. + char const* sourceCode = R"( + contract DCE { + function () internal returns (uint) stored; + function DCE() { + stored = f; + } + function f() internal returns (uint) { return 7; } + function test() returns (uint) { return stored(); } + } + )"; + compileBothVersions(sourceCode); + compareVersions("test()"); +} + BOOST_AUTO_TEST_SUITE_END() } |