diff options
author | chriseth <chris@ethereum.org> | 2016-10-24 17:45:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 17:45:54 +0800 |
commit | cb1fcaf6f65608d6528753f1a998c2cf9f67baab (patch) | |
tree | 27cb4241c115a893644d25a3f9ae8cf55a7c80a5 /libsolidity | |
parent | 84b43b91396a3d60da055d2957501f4690fcb5cc (diff) | |
parent | 31ffe01463619ae4bd5fb910b98572ebd9c1a13b (diff) | |
download | dexon-solidity-cb1fcaf6f65608d6528753f1a998c2cf9f67baab.tar.gz dexon-solidity-cb1fcaf6f65608d6528753f1a998c2cf9f67baab.tar.zst dexon-solidity-cb1fcaf6f65608d6528753f1a998c2cf9f67baab.zip |
Merge pull request #1240 from ethereum/1151
ast: super contract type does not contain native members
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/Types.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index eb98047c..a412d421 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -23,6 +23,7 @@ #include <libsolidity/ast/Types.h> #include <limits> #include <boost/range/adaptor/reversed.hpp> +#include <boost/range/adaptor/sliced.hpp> #include <libdevcore/CommonIO.h> #include <libdevcore/CommonData.h> #include <libdevcore/SHA3.h> @@ -1324,7 +1325,10 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const*) con if (m_super) { // add the most derived of all functions which are visible in derived contracts - for (ContractDefinition const* base: m_contract.annotation().linearizedBaseContracts) + auto bases = m_contract.annotation().linearizedBaseContracts; + solAssert(bases.size() >= 1, "linearizedBaseContracts should at least contain the most derived contract."); + // `sliced(1, ...)` ignores the most derived contract, which should not be searchable from `super`. + for (ContractDefinition const* base: bases | boost::adaptors::sliced(1, bases.size())) for (FunctionDefinition const* function: base->definedFunctions()) { if (!function->isVisibleInDerivedContracts()) |