From 34de70a553c0863626f254ed89d689611b7f9c0a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 18 Aug 2010 18:53:44 +0000 Subject: Update for LLVM 2.7. Factor out mostly duplicated code in Env::topLevel and Env::innerMost. git-svn-id: http://svn.drobilla.net/resp/resp@259 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- src/resp.hpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/resp.hpp') diff --git a/src/resp.hpp b/src/resp.hpp index 34106f4..752796b 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -87,18 +87,14 @@ struct Env : public list< vector< pair > > { return &b->second; return NULL; } - bool topLevel(const K& key) const { - for (typename Frame::const_iterator b = this->back().begin(); b != this->back().end(); ++b) - if (b->first == key) - return true; - return false; - } - bool innermost(const K& key) const { - for (typename Frame::const_iterator b = this->front().begin(); b != this->front().end(); ++b) + bool contains(const Frame& frame, const K& key) const { + for (typename Frame::const_iterator b = frame.begin(); b != frame.end(); ++b) if (b->first == key) return true; return false; } + bool topLevel(const K& key) const { return contains(this->back(), key); } + bool innermost(const K& key) const { return contains(this->front(), key); } }; template @@ -119,7 +115,7 @@ ostream& operator<<(ostream& out, const Env& env) { * Lexer: Text (istream) -> S-Expressions (SExp) * ***************************************************************************/ -class AST; +struct AST; AST* readExpression(Cursor& cur, std::istream& in); -- cgit v1.2.1