From 54bb98ea98aea60ef951ab73987128a78f5cd9aa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 5 Mar 2009 06:05:49 +0000 Subject: Cleanup. git-svn-id: http://svn.drobilla.net/resp/tuplr@41 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- tuplr.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'tuplr.cpp') diff --git a/tuplr.cpp b/tuplr.cpp index c4ee5d2..31a83e5 100644 --- a/tuplr.cpp +++ b/tuplr.cpp @@ -59,11 +59,11 @@ struct Error { template struct Exp { // ::= Atom | (Exp*) - Exp(Cursor c) : loc(c), type(LIST) {} - Exp(Cursor c, const A& a) : loc(c), type(ATOM), atom(a) {} - Cursor loc; - enum { ATOM, LIST } type; + Exp(Cursor c) : type(LIST), loc(c) {} + Exp(Cursor c, const A& a) : type(ATOM), loc(c), atom(a) {} typedef std::vector< Exp > List; + enum { ATOM, LIST } type; + Cursor loc; A atom; List list; }; @@ -153,7 +153,7 @@ struct ASTLiteral : public AST { ASTLiteral(VT v) : val(v) {} bool operator==(const AST& rhs) const { const ASTLiteral* r = dynamic_cast*>(&rhs); - return r && val == r->val; + return (r && (val == r->val)); } string str() const { return (format("%1%") % val).str(); } void constrain(TEnv& tenv) const; @@ -219,13 +219,7 @@ struct AType : public ASTTuple { AType(ASTSymbol* n, const Type* t) : var(false), ctype(t) { push_back(n); } - string str() const { - if (var) { - return (format("?%1%") % id).str(); - } else { - return ASTTuple::str(); - } - } + string str() const { return var ? (format("?%1%") % id).str() : ASTTuple::str(); } void constrain(TEnv& tenv) const {} Value* compile(CEnv& cenv) { return NULL; } bool concrete() const { @@ -258,7 +252,7 @@ struct AType : public ASTTuple { } else { return ctype; } - }; + } bool var; unsigned id; private: @@ -768,9 +762,9 @@ template<> void \ ASTLiteral::constrain(TEnv& tenv) const { tenv.constrain(this, tenv.named(NAME)); } /// Literal template instantiations -LITERAL(int32_t, "Int", ConstantInt::get(Type::Int32Ty, val, true)); -LITERAL(float, "Float", ConstantFP::get(Type::FloatTy, val)); -LITERAL(bool, "Bool", ConstantInt::get(Type::Int1Ty, val, false)); +LITERAL(int32_t, "Int", ConstantInt::get(Type::Int32Ty, val, true)) +LITERAL(float, "Float", ConstantFP::get(Type::FloatTy, val)) +LITERAL(bool, "Bool", ConstantInt::get(Type::Int1Ty, val, false)) static Function* compileFunction(CEnv& cenv, const std::string& name, const Type* retT, ASTTuple& prot, -- cgit v1.2.1