aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-20 02:18:34 +0800
committerChristian <c@ethdev.com>2015-01-20 06:35:04 +0800
commit6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9 (patch)
tree0cedcacb974cd0d7f15734bccde634e76c47a565 /Types.cpp
parent4d833bc86bf10a685a8b5d72e90c49a24a33f8b3 (diff)
downloaddexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.tar.gz
dexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.tar.zst
dexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.zip
Explicit calls to base class function.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Types.cpp b/Types.cpp
index a99e4853..94fd5750 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -695,6 +695,29 @@ bool TypeType::operator==(Type const& _other) const
return *getActualType() == *other.getActualType();
}
+MemberList const& TypeType::getMembers() const
+{
+ // We need to lazy-initialize it because of recursive references.
+ if (!m_members)
+ {
+ map<string, TypePointer> members;
+ if (m_actualType->getCategory() == Category::CONTRACT && m_currentContract != nullptr)
+ {
+ ContractDefinition const& contract = dynamic_cast<ContractType const&>(*m_actualType).getContractDefinition();
+ vector<ContractDefinition const*> currentBases = m_currentContract->getLinearizedBaseContracts();
+ if (find(currentBases.begin(), currentBases.end(), &contract) != currentBases.end())
+ // We are accessing the type of a base contract, so add all public and private
+ // functions. Note that this does not add inherited functions on purpose.
+ for (ASTPointer<FunctionDefinition> const& f: contract.getDefinedFunctions())
+ if (f->getName() != contract.getName())
+ members[f->getName()] = make_shared<FunctionType>(*f);
+ }
+ m_members.reset(new MemberList(members));
+ }
+ return *m_members;
+}
+
+
MagicType::MagicType(MagicType::Kind _kind):
m_kind(_kind)
{