aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-15 21:22:20 +0000
committerDavid Robillard <d@drobilla.net>2009-10-15 21:22:20 +0000
commit1ea87d79fc98553abec35eb74eb599d254d908b0 (patch)
tree71a1c82dbd09fc4ad69874c5c48a9b7a6c1cc1e7
parent6d4564794d2257ac9e9f1fb674914c5abaed3951 (diff)
downloadresp-1ea87d79fc98553abec35eb74eb599d254d908b0.tar.gz
resp-1ea87d79fc98553abec35eb74eb599d254d908b0.tar.bz2
resp-1ea87d79fc98553abec35eb74eb599d254d908b0.zip
Tidy.
git-svn-id: http://svn.drobilla.net/resp/tuplr@231 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--src/tuplr.hpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/tuplr.hpp b/src/tuplr.hpp
index b1bb985..61e3f41 100644
--- a/src/tuplr.hpp
+++ b/src/tuplr.hpp
@@ -69,7 +69,7 @@ struct Env : public list< vector< pair<K,V> > > {
typedef vector< pair<K,V> > Frame;
Env() : list<Frame>(1) {}
virtual void push(Frame f=Frame()) { list<Frame>::push_front(f); }
- virtual void pop() { assert(!this->empty()); list<Frame>::pop_front(); }
+ virtual void pop() { list<Frame>::pop_front(); }
const V& def(const K& k, const V& v) {
for (typename Frame::iterator b = this->begin()->begin(); b != this->begin()->end(); ++b)
if (b->first == k)
@@ -135,8 +135,8 @@ struct Object {
/// Always allocated with pool.alloc, so this - sizeof(Header) is a valid Header*.
inline Header* header() const { return (Header*)((char*)this - sizeof(Header)); }
- inline bool marked() const { return header()->mark != 0; }
- inline void mark(bool b) const { header()->mark = 1; }
+ inline bool marked() const { return header()->mark != 0; }
+ inline void mark(bool b) const { header()->mark = 1; }
static void* operator new(size_t size) { return pool.alloc(size); }
static void operator delete(void* ptr) {}
@@ -160,13 +160,13 @@ extern ostream& operator<<(ostream& out, const AST* ast);
struct AST : public Object {
AST(Cursor c=Cursor()) : loc(c) {}
virtual ~AST() {}
- virtual bool value() const { return true; }
- virtual bool operator==(const AST& o) const = 0;
- virtual bool contains(const AST* child) const { return false; }
- virtual void constrain(TEnv& tenv, Constraints& c) const {}
- virtual AST* cps(TEnv& tenv, AST* cont);
- virtual void lift(CEnv& cenv) {}
- virtual CVal compile(CEnv& cenv) = 0;
+ virtual bool value() const { return true; }
+ virtual bool operator==(const AST& o) const = 0;
+ virtual bool contains(const AST* child) const { return false; }
+ virtual void constrain(TEnv& tenv, Constraints& c) const {}
+ virtual AST* cps(TEnv& tenv, AST* cont);
+ virtual void lift(CEnv& cenv) {}
+ virtual CVal compile(CEnv& cenv) = 0;
string str() const { ostringstream ss; ss << this; return ss.str(); }
template<typename T> T to() { return dynamic_cast<T>(this); }
template<typename T> T const to() const { return dynamic_cast<T const>(this); }
@@ -242,19 +242,20 @@ struct ATuple : public AST {
newvec[_len++] = ast;
_vec = newvec;
}
- const AST* head() const { assert(_len > 0); return _vec[0]; }
- AST* head() { assert(_len > 0); return _vec[0]; }
- const AST* last() const { return _vec[_len - 1]; }
- AST* last() { return _vec[_len - 1]; }
- size_t size() const { return _len; }
- bool empty() const { return _len == 0; }
-
- typedef AST** iterator;
- typedef AST* const * const_iterator;
+ const AST* head() const { assert(_len > 0); return _vec[0]; }
+ AST* head() { assert(_len > 0); return _vec[0]; }
+ const AST* last() const { return _vec[_len - 1]; }
+ AST* last() { return _vec[_len - 1]; }
+ size_t size() const { return _len; }
+ bool empty() const { return _len == 0; }
+
+ typedef AST** iterator;
+ typedef AST* const* const_iterator;
const_iterator begin() const { return _vec; }
iterator begin() { return _vec; }
const_iterator end() const { return _vec + _len; }
iterator end() { return _vec + _len; }
+
bool value() const { return false; }
bool operator==(const AST& rhs) const {
const ATuple* rt = rhs.to<const ATuple*>();