aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-03-21 22:05:59 +0800
committerchriseth <chris@ethereum.org>2017-03-21 22:05:59 +0800
commit5ced3af3a0579e4e0d5e0d923b3e9d3f21197bfa (patch)
tree30c01ad10e10e68340504ff3e78ede09a17dd8cc /libsolidity/analysis
parent96c09fcbcd21ed6b907e055c915d5f13814b87d5 (diff)
downloaddexon-solidity-5ced3af3a0579e4e0d5e0d923b3e9d3f21197bfa.tar.gz
dexon-solidity-5ced3af3a0579e4e0d5e0d923b3e9d3f21197bfa.tar.zst
dexon-solidity-5ced3af3a0579e4e0d5e0d923b3e9d3f21197bfa.zip
Visit structs only once.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index b0551fcb..30e84f11 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -64,8 +64,10 @@ bool TypeChecker::visit(ContractDefinition const& _contract)
{
m_scope = &_contract;
- // We force our own visiting order here.
- //@TODO structs will be visited again below, but it is probably fine.
+ // We force our own visiting order here. The structs have to be excluded below.
+ set<ASTNode const*> visited;
+ for (auto const& s: _contract.definedStructs())
+ visited.insert(s);
ASTNode::listAccept(_contract.definedStructs(), *this);
ASTNode::listAccept(_contract.baseContracts(), *this);
@@ -113,7 +115,9 @@ bool TypeChecker::visit(ContractDefinition const& _contract)
_contract.annotation().isFullyImplemented = false;
}
- ASTNode::listAccept(_contract.subNodes(), *this);
+ for (auto const& n: _contract.subNodes())
+ if (!visited.count(n.get()))
+ n->accept(*this);
checkContractExternalTypeClashes(_contract);
// check for hash collisions in function signatures