diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-03-01 01:30:33 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-03-02 18:51:13 +0800 |
commit | bbaa9fef6c8272c567af49ecea4f68c59c335778 (patch) | |
tree | 35c0a09ec87b456a69359906a7866233b108993b /AST.cpp | |
parent | efe8f9f8a054a7a7489db44e236e5424becf9db7 (diff) | |
download | dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar.gz dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar.bz2 dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar.lz dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar.xz dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.tar.zst dexon-solidity-bbaa9fef6c8272c567af49ecea4f68c59c335778.zip |
getInheritableMembers() does not look at BaseContracts
- Also adding tests for improper accessing members of other contracts.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
@@ -215,26 +215,23 @@ vector<ASTPointer<Declaration>> const& ContractDefinition::getInheritableMembers { set<string> memberSeen; m_inheritableMembers.reset(new vector<ASTPointer<Declaration>>()); - for (ContractDefinition const* contract: getLinearizedBaseContracts()) + auto addInheritableMember = [&](ASTPointer<Declaration> const& _decl) { - auto addInheritableMember = [&](ASTPointer<Declaration> const& _decl) + if (memberSeen.count(_decl->getName()) == 0 && _decl->isVisibleInDerivedContracts()) { - if (memberSeen.count(_decl->getName()) == 0 && _decl->isVisibleInDerivedContracts()) - { - memberSeen.insert(_decl->getName()); - m_inheritableMembers->push_back(_decl); - } - }; + memberSeen.insert(_decl->getName()); + m_inheritableMembers->push_back(_decl); + } + }; - for (ASTPointer<FunctionDefinition> const& f: contract->getDefinedFunctions()) - addInheritableMember(f); + for (ASTPointer<FunctionDefinition> const& f: getDefinedFunctions()) + addInheritableMember(f); - for (ASTPointer<VariableDeclaration> const& v: contract->getStateVariables()) - addInheritableMember(v); + for (ASTPointer<VariableDeclaration> const& v: getStateVariables()) + addInheritableMember(v); - for (ASTPointer<StructDefinition> const& s: contract->getDefinedStructs()) - addInheritableMember(s); - } + for (ASTPointer<StructDefinition> const& s: getDefinedStructs()) + addInheritableMember(s); } return *m_inheritableMembers; } |