aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-08-18 18:53:44 +0000
committerDavid Robillard <d@drobilla.net>2010-08-18 18:53:44 +0000
commit34de70a553c0863626f254ed89d689611b7f9c0a (patch)
tree59e3e7f05acee64b62b2ef72caf2c263f8c65029 /src/resp.hpp
parent7bec36818542d53a52fb285757b1c5947b77b443 (diff)
downloadresp-34de70a553c0863626f254ed89d689611b7f9c0a.tar.gz
resp-34de70a553c0863626f254ed89d689611b7f9c0a.tar.bz2
resp-34de70a553c0863626f254ed89d689611b7f9c0a.zip
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
Diffstat (limited to 'src/resp.hpp')
-rw-r--r--src/resp.hpp14
1 files changed, 5 insertions, 9 deletions
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<K,V> > > {
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<typename K, typename V>
@@ -119,7 +115,7 @@ ostream& operator<<(ostream& out, const Env<K,V>& env) {
* Lexer: Text (istream) -> S-Expressions (SExp) *
***************************************************************************/
-class AST;
+struct AST;
AST* readExpression(Cursor& cur, std::istream& in);