diff options
author | David Robillard <d@drobilla.net> | 2009-07-04 05:20:15 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-07-04 05:20:15 +0000 |
commit | 8d23d67e49f222756d327f886be6d7c47aa57772 (patch) | |
tree | 254e85232aac2434b787961f0c12d2274734e368 /src | |
parent | 7164809b051050fb4f4877793b9739b6177bcab1 (diff) | |
download | resp-8d23d67e49f222756d327f886be6d7c47aa57772.tar.gz resp-8d23d67e49f222756d327f886be6d7c47aa57772.tar.bz2 resp-8d23d67e49f222756d327f886be6d7c47aa57772.zip |
Tidy.
git-svn-id: http://svn.drobilla.net/resp/tuplr@183 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src')
-rw-r--r-- | src/llvm.cpp | 9 | ||||
-rw-r--r-- | src/tuplr.hpp | 17 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp index 0f13f76..b01724e 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -396,7 +396,7 @@ void ACall::lift(CEnv& cenv) { AFn* c = cenv.tenv.resolve(at(0))->to<AFn*>(); - AType argsT(loc, NULL); + AType argsT(loc); // Lift arguments for (size_t i = 1; i < size(); ++i) { @@ -421,7 +421,7 @@ ACall::compile(CEnv& cenv) if (!c) return NULL; // Primitive - AType protT(loc, NULL); + AType protT(loc); vector<const Type*> types; for (size_t i = 1; i < size(); ++i) { protT.push_back(cenv.type(at(i))); @@ -430,7 +430,10 @@ ACall::compile(CEnv& cenv) TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(c); assert(gt != cenv.tenv.genericTypes.end()); - AType fnT(loc, cenv.penv.sym("Fn"), &protT, cenv.type(this), 0); + AType fnT(loc); + fnT.push_back(cenv.penv.sym("Fn")); + fnT.push_back(&protT); + fnT.push_back(cenv.type(this)); Function* f = (Function*)c->impls.find(&fnT); THROW_IF(!f, loc, (format("callee failed to compile for type %1%") % fnT.str()).str()); diff --git a/src/tuplr.hpp b/src/tuplr.hpp index 54d7098..018607c 100644 --- a/src/tuplr.hpp +++ b/src/tuplr.hpp @@ -116,7 +116,6 @@ class AST; AST* readExpression(Cursor& cur, std::istream& in); - /*************************************************************************** * Backend Types * ***************************************************************************/ @@ -316,16 +315,8 @@ private: /// Type Expression, e.g. "Int", "(Fn (Int Int) Float)" struct AType : public ATuple { AType(ASymbol* s) : ATuple(s->loc), kind(PRIM), id(0) { push_back(s); } - AType(Cursor c, unsigned i, LAddr a) : ATuple(c), kind(VAR), id(i) {} - AType(Cursor c, AST* ast, ...) : ATuple(c), kind(EXPR), id(0) { - if (!ast) return; - va_list args; - va_start(args, ast); - push_back(ast); - for (AST* a = va_arg(args, AST*); a; a = va_arg(args, AST*)) - push_back(a); - va_end(args); - } + AType(Cursor c, unsigned i) : ATuple(c), kind(VAR), id(i) {} + AType(Cursor c) : ATuple(c), kind(EXPR), id(0) {} AType(Cursor c, AST* ast, va_list args) : ATuple(c, ast, args), kind(EXPR), id(0) {} CValue compile(CEnv& cenv) { return NULL; } bool var() const { return kind == VAR; } @@ -586,7 +577,7 @@ struct TEnv : public Env< const ASymbol*, pair<AST*, AType*> > { TEnv(PEnv& p) : penv(p), varID(1) {} AType* fresh(const ASymbol* sym) { assert(sym); - AType* ret = new AType(sym->loc, varID++, LAddr()); + AType* ret = new AType(sym->loc, varID++); def(sym, make_pair((AST*)NULL, ret)); return ret; } @@ -599,7 +590,7 @@ struct TEnv : public Env< const ASymbol*, pair<AST*, AType*> > { if (v != vars.end()) return v->second; - AType* ret = new AType(ast ? ast->loc : Cursor(), varID++, LAddr()); + AType* ret = new AType(ast ? ast->loc : Cursor(), varID++); if (ast) vars[ast] = ret; |