aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-18 02:54:53 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-20 22:09:52 +0800
commitff9039b2a82f5679cb79bf0a47f280283554ba89 (patch)
tree501b13e671522c830b05370dc0b00a8619855679 /libsolidity
parent6781ec105f43bb98fd165c4ba86c76ebc1fb9587 (diff)
downloaddexon-solidity-ff9039b2a82f5679cb79bf0a47f280283554ba89.tar.gz
dexon-solidity-ff9039b2a82f5679cb79bf0a47f280283554ba89.tar.zst
dexon-solidity-ff9039b2a82f5679cb79bf0a47f280283554ba89.zip
When a contract type is super, its members do not contain the functions of itself
Fixes #1151
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/ast/Types.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index eb98047c..b28ae482 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -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())