diff options
Diffstat (limited to 'src/tuplr.hpp')
-rw-r--r-- | src/tuplr.hpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/tuplr.hpp b/src/tuplr.hpp index 18e8830..9a87c37 100644 --- a/src/tuplr.hpp +++ b/src/tuplr.hpp @@ -296,9 +296,10 @@ private: /// Type Expression, e.g. "Int", "(Fn (Int Int) Float)" struct AType : public ATuple { + enum Kind { VAR, PRIM, EXPR, DOTS }; AType(ASymbol* s) : ATuple(s->loc), kind(PRIM), id(0) { push_back(s); } AType(Cursor c, unsigned i) : ATuple(c), kind(VAR), id(i) {} - AType(Cursor c) : ATuple(c), kind(EXPR), id(0) {} + AType(Cursor c, Kind k=EXPR) : ATuple(c), kind(k), id(0) {} AType(Cursor c, AST* ast, va_list args) : ATuple(c, ast, args), kind(EXPR), id(0) {} AType(const AType& copy) : ATuple(copy), kind(copy.kind), id(copy.id) {} CVal compile(CEnv& cenv) { return NULL; } @@ -329,8 +330,8 @@ struct AType : public ATuple { } return false; // never reached } - enum { VAR, PRIM, EXPR } kind; - unsigned id; + Kind kind; + unsigned id; }; /// Type substitution @@ -569,10 +570,11 @@ inline ostream& operator<<(ostream& out, const Constraints& c) { /// Type-Time Environment struct TEnv : public Env<const ASymbol*, AType*> { - TEnv(PEnv& p) : penv(p), varID(1), - Fn(new AType(penv.sym("Fn"))), - Tup(new AType(penv.sym("Tup"))), - ellipses(new AType(penv.sym("..."))) + TEnv(PEnv& p) + : penv(p) + , varID(1) + , Fn(new AType(penv.sym("Fn"))) + , Tup(new AType(penv.sym("Tup"))) { Object::pool.addRoot(Fn); } @@ -606,7 +608,6 @@ struct TEnv : public Env<const ASymbol*, AType*> { AType* Fn; AType* Tup; - AType* ellipses; }; Subst unify(const Constraints& c); |