diff options
author | chriseth <chris@ethereum.org> | 2016-10-19 16:33:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-19 16:33:41 +0800 |
commit | 65da8e4e160721cdf8fa86c8112a300d88335792 (patch) | |
tree | 07b18a29882255d984272acc433eed032ad5e611 | |
parent | 0fd6f2b5a6f5b3a977f4cabbe32582684a91bb2f (diff) | |
parent | a743d7989b085d440693a3958f7541502db87def (diff) | |
download | dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar.gz dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar.bz2 dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar.lz dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar.xz dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.tar.zst dexon-solidity-65da8e4e160721cdf8fa86c8112a300d88335792.zip |
Merge pull request #1244 from ethereum/1242
`super`'s size on stack is zero
-rw-r--r-- | Changelog.md | 1 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 1 | ||||
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 9 |
3 files changed, 11 insertions, 0 deletions
diff --git a/Changelog.md b/Changelog.md index bc79b88a..fb3b23c7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Features: Bugfixes: * Disallow unknown options in `solc` + * Code Generator: expect zero stack increase after `super` as an expression * Inline assembly: support the `address` opcode * Inline assembly: fix parsing of assignment after a label. diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 9173f39a..f65d25fb 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -623,6 +623,7 @@ public: } virtual unsigned storageBytes() const override { return 20; } virtual bool canLiveOutsideStorage() const override { return true; } + virtual unsigned sizeOnStack() const override { return m_super ? 0 : 1; } virtual bool isValueType() const override { return true; } virtual std::string toString(bool _short) const override; virtual std::string canonicalName(bool _addDataLocation) const override; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 155f117f..692abe57 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2513,6 +2513,15 @@ BOOST_AUTO_TEST_CASE(super_in_constructor) BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 | 2 | 4 | 8)); } +BOOST_AUTO_TEST_CASE(super_alone) +{ + char const* sourceCode = R"( + contract A { function f() { super; } } + )"; + compileAndRun(sourceCode, 0, "A"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs()); +} + BOOST_AUTO_TEST_CASE(fallback_function) { char const* sourceCode = R"( |