diff options
author | Christian <c@ethdev.com> | 2015-01-20 22:58:04 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-20 22:58:04 +0800 |
commit | d854e56789c4bf2f5caca563dd0e660dababf181 (patch) | |
tree | 79b755313238b71fe44ae01504ac95ef6c38e338 /AST.cpp | |
parent | 417f9c03d03a9fa52665bd238a42081d55df62c9 (diff) | |
download | dexon-solidity-d854e56789c4bf2f5caca563dd0e660dababf181.tar.gz dexon-solidity-d854e56789c4bf2f5caca563dd0e660dababf181.tar.zst dexon-solidity-d854e56789c4bf2f5caca563dd0e660dababf181.zip |
Include virtual function overrides in constructor context.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -82,7 +82,7 @@ map<FixedHash<4>, FunctionDefinition const*> ContractDefinition::getInterfaceFun FunctionDefinition const* ContractDefinition::getConstructor() const { for (ASTPointer<FunctionDefinition> const& f: m_definedFunctions) - if (f->getName() == getName()) + if (f->isConstructor()) return f.get(); return nullptr; } @@ -95,7 +95,7 @@ void ContractDefinition::checkIllegalOverrides() const for (ContractDefinition const* contract: getLinearizedBaseContracts()) for (ASTPointer<FunctionDefinition> const& function: contract->getDefinedFunctions()) { - if (function->getName() == contract->getName()) + if (function->isConstructor()) continue; // constructors can neither be overriden nor override anything FunctionDefinition const*& override = functions[function->getName()]; if (!override) @@ -115,8 +115,7 @@ vector<pair<FixedHash<4>, FunctionDefinition const*>> const& ContractDefinition: m_interfaceFunctionList.reset(new vector<pair<FixedHash<4>, FunctionDefinition const*>>()); for (ContractDefinition const* contract: getLinearizedBaseContracts()) for (ASTPointer<FunctionDefinition> const& f: contract->getDefinedFunctions()) - if (f->isPublic() && f->getName() != contract->getName() && - functionsSeen.count(f->getName()) == 0) + if (f->isPublic() && !f->isConstructor() && functionsSeen.count(f->getName()) == 0) { functionsSeen.insert(f->getName()); FixedHash<4> hash(dev::sha3(f->getCanonicalSignature())); |