diff options
author | David Robillard <d@drobilla.net> | 2009-03-07 02:28:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-03-07 02:28:09 +0000 |
commit | 240b9f437bf87e98ca2c4ad8f242e86fca7f24e5 (patch) | |
tree | c4f9cb64594d84318b87b3fb3447f286e6bc303f /tuplr.hpp | |
parent | 76a2dc8afc2e59e2927cacb7270e28943ec9841d (diff) | |
download | resp-240b9f437bf87e98ca2c4ad8f242e86fca7f24e5.tar.gz resp-240b9f437bf87e98ca2c4ad8f242e86fca7f24e5.tar.bz2 resp-240b9f437bf87e98ca2c4ad8f242e86fca7f24e5.zip |
Oops.
git-svn-id: http://svn.drobilla.net/resp/tuplr@70 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.hpp')
-rw-r--r-- | tuplr.hpp | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -135,11 +135,8 @@ private: struct ASTTuple : public AST, public vector<AST*> { ASTTuple(const vector<AST*>& t=vector<AST*>(), Cursor c=Cursor()) : AST(c), vector<AST*>(t) {} ASTTuple(size_t size, Cursor c) : AST(c), vector<AST*>(size) {} - ASTTuple(AST* ast, ...) { + ASTTuple(Cursor c, AST* ast, ...) : AST(c) { va_list args; va_start(args, ast); - init(ast, args); - } - void init(AST* ast, va_list args) { push_back(ast); for (AST* a = va_arg(args, AST*); a; a = va_arg(args, AST*)) push_back(a); @@ -180,9 +177,12 @@ struct AType : public ASTTuple { AType(unsigned i, Cursor c=Cursor()) : ASTTuple(0, c), kind(VAR), id(i) {} AType(ASTSymbol* s) : ASTTuple(0, s->loc), kind(PRIM), id(0) { push_back(s); } AType(const ASTTuple& t, Cursor c) : ASTTuple(t, c), kind(EXPR), id(0) {} - AType(Cursor c, AST* ast, ...) : ASTTuple(0, c) { + AType(Cursor c, AST* ast, ...) : ASTTuple(0, c), kind(EXPR), id(0) { va_list args; va_start(args, ast); - init(ast, args); + push_back(ast); + for (AST* a = va_arg(args, AST*); a; a = va_arg(args, AST*)) + push_back(a); + va_end(args); } string str() const { switch (kind) { @@ -236,8 +236,8 @@ struct Funcs : public list< pair<AType*, CFunction> > { /// Closure (first-class function with captured lexical bindings) struct ASTClosure : public ASTTuple { - ASTClosure(ASTTuple* p, AST* b, const string& n="") - : ASTTuple(0, p, b, NULL), name(n) {} + ASTClosure(Cursor c, ASTTuple* p, AST* b, const string& n="") + : ASTTuple(c, 0, p, b, NULL), name(n) {} bool operator==(const AST& rhs) const { return this == &rhs; } string str() const { return (format("%1%") % this).str(); } void constrain(TEnv& tenv) const; @@ -387,8 +387,8 @@ inline AST* parseFn(PEnv& penv, const SExp& exp, void* arg) { SExp::List::const_iterator a = exp.list.begin(); ++a; - return new ASTClosure( - new ASTTuple(pmap(penv, *a), (*a++).loc), + return new ASTClosure(exp.loc, + new ASTTuple(pmap(penv, *a++)), parseExpression(penv, *a++)); } |