diff options
author | chriseth <chris@ethereum.org> | 2018-03-16 02:07:25 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-03 22:27:28 +0800 |
commit | 5bdadff0d8a9c32745dd46aa639283718613efdc (patch) | |
tree | e7661ff74a4620669381041a2f4c719d5abaa77f /libsolidity/ast/Types.cpp | |
parent | c42caedec2b6dc2bfb268f538eecb1d4ee18f9d8 (diff) | |
download | dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar.gz dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar.bz2 dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar.lz dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar.xz dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.tar.zst dexon-solidity-5bdadff0d8a9c32745dd46aa639283718613efdc.zip |
Fix detection of recursive structs.
Diffstat (limited to 'libsolidity/ast/Types.cpp')
-rw-r--r-- | libsolidity/ast/Types.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 42fd1c3d..42f6b5ca 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1972,9 +1972,12 @@ bool StructType::recursive() const if (!m_recursive.is_initialized()) { set<StructDefinition const*> structsSeen; + set<StructDefinition const*> structsProcessed; function<bool(StructType const*)> check = [&](StructType const* t) -> bool { StructDefinition const* str = &t->structDefinition(); + if (structsProcessed.count(str)) + return false; if (structsSeen.count(str)) return true; structsSeen.insert(str); @@ -1987,6 +1990,8 @@ bool StructType::recursive() const if (check(innerStruct)) return true; } + structsSeen.erase(str); + structsProcessed.insert(str); return false; }; m_recursive = check(this); |