aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-20 22:58:04 +0800
committerChristian <c@ethdev.com>2015-01-20 22:58:04 +0800
commitd854e56789c4bf2f5caca563dd0e660dababf181 (patch)
tree79b755313238b71fe44ae01504ac95ef6c38e338 /AST.cpp
parent417f9c03d03a9fa52665bd238a42081d55df62c9 (diff)
downloaddexon-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.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/AST.cpp b/AST.cpp
index 2cb738d3..82667367 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -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()));