When a contract type is super, its members do not contain the functions of itself

Fixes #1151
This commit is contained in:
Yoichi Hirai 2016-10-17 20:54:53 +02:00
parent 6781ec105f
commit ff9039b2a8
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -1324,7 +1324,14 @@ 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;
if (bases.size() < 1)
BOOST_THROW_EXCEPTION(
InternalCompilerError() <<
errinfo_comment("linearizedBaseContracts should at least contain the most derived contract.")
);
bases.erase(bases.begin()); // Remove the most derived contract, which should not be searchable from `super`.
for (ContractDefinition const* base: bases)
for (FunctionDefinition const* function: base->definedFunctions())
{
if (!function->isVisibleInDerivedContracts())