aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-05 06:05:49 +0000
committerDavid Robillard <d@drobilla.net>2009-03-05 06:05:49 +0000
commit54bb98ea98aea60ef951ab73987128a78f5cd9aa (patch)
treef5230e583e3f3de6815741d205da6ef68fcee935 /tuplr.cpp
parentabe7fec15a97f71f2ee1df15a3d85ce59a232dc6 (diff)
downloadresp-54bb98ea98aea60ef951ab73987128a78f5cd9aa.tar.gz
resp-54bb98ea98aea60ef951ab73987128a78f5cd9aa.tar.bz2
resp-54bb98ea98aea60ef951ab73987128a78f5cd9aa.zip
Cleanup.
git-svn-id: http://svn.drobilla.net/resp/tuplr@41 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.cpp')
-rw-r--r--tuplr.cpp26
1 files changed, 10 insertions, 16 deletions
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<typename A>
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<A> > 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<VT>* r = dynamic_cast<const ASTLiteral<VT>*>(&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<CT>::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,