diff options
-rw-r--r-- | libdevcore/CommonData.h | 6 | ||||
-rw-r--r-- | libsolidity/ast/AST.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 4297f606..ab4bfe68 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -166,6 +166,12 @@ template <class T, class U> std::vector<T>& operator+=(std::vector<T>& _a, U con _a.push_back(i); return _a; } +/// Concatenate the contents of a container onto a set +template <class T, class U> std::set<T>& operator+=(std::set<T>& _a, U const& _b) +{ + _a.insert(_b.begin(), _b.end()); + return _a; +} /// Concatenate two vectors of elements. template <class T> inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const& _b) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index f4ab6491..ebc8bd48 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -95,10 +95,7 @@ set<SourceUnit const*> SourceUnit::referencedSourceUnits(bool _recurse, set<Sour _skipList.insert(sourceUnit); sourceUnits.insert(sourceUnit); if (_recurse) - { - set<SourceUnit const*> referencedSourceUnits = sourceUnit->referencedSourceUnits(true, _skipList); - sourceUnits.insert(referencedSourceUnits.begin(), referencedSourceUnits.end()); - } + sourceUnits += sourceUnit->referencedSourceUnits(true, _skipList); } } return sourceUnits; |