aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-12 05:01:21 +0000
committerDavid Robillard <d@drobilla.net>2009-03-12 05:01:21 +0000
commit251232bc3bbf6d98f9f6f91352bdcceef3b102f0 (patch)
treebb3d1c65e672d0b9d933225a261337c44ebf2b7c /tuplr.hpp
parent23978add2847c4ba1e8b2f5a63595fe1317ea992 (diff)
downloadresp-251232bc3bbf6d98f9f6f91352bdcceef3b102f0.tar.gz
resp-251232bc3bbf6d98f9f6f91352bdcceef3b102f0.tar.bz2
resp-251232bc3bbf6d98f9f6f91352bdcceef3b102f0.zip
Encapsulate more types.
git-svn-id: http://svn.drobilla.net/resp/tuplr@83 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.hpp')
-rw-r--r--tuplr.hpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/tuplr.hpp b/tuplr.hpp
index 16a9a75..cc0b086 100644
--- a/tuplr.hpp
+++ b/tuplr.hpp
@@ -406,10 +406,6 @@ struct Env : public list< map<K,V> > {
* Typing (Prefix T for Type) *
***************************************************************************/
-struct TSubst : public map<AType*, AType*> {
- TSubst(AType* s=0, AType* t=0) { if (s && t) insert(make_pair(s, t)); }
-};
-
/// Type-Time Environment
struct TEnv : public Env<const AST*,AType*> {
TEnv(PEnv& p) : penv(p), varID(1) {}
@@ -417,6 +413,9 @@ struct TEnv : public Env<const AST*,AType*> {
Constraint(AType* a, AType* b, Cursor c) : pair<AType*,AType*>(a, b), loc(c) {}
Cursor loc;
};
+ struct Subst : public map<AType*, AType*> {
+ Subst(AType* s=0, AType* t=0) { if (s && t) insert(make_pair(s, t)); }
+ };
typedef list<Constraint> Constraints;
AType* var(Cursor c=Cursor()) { return new AType(varID++, c); }
AType* type(const AST* ast) {
@@ -430,9 +429,9 @@ struct TEnv : public Env<const AST*,AType*> {
assert(!dynamic_cast<const AType*>(o));
constraints.push_back(Constraint(type(o), t, o->loc));
}
- void solve() { apply(unify(constraints)); }
- void apply(const TSubst& substs);
- static TSubst unify(const Constraints& c);
+ void solve() { apply(unify(constraints)); }
+ void apply(const Subst& substs);
+ static Subst unify(const Constraints& c);
PEnv& penv;
Constraints constraints;
@@ -444,8 +443,6 @@ struct TEnv : public Env<const AST*,AType*> {
* Code Generation *
***************************************************************************/
-struct CEnvPimpl;
-
/// Compile-Time Environment
struct CEnv {
CEnv(PEnv& p, TEnv& t, CEngine& e, ostream& os=std::cout, ostream& es=std::cerr);
@@ -472,7 +469,8 @@ struct CEnv {
Log log;
private:
- CEnvPimpl* _pimpl;
+ struct PImpl; ///< Private Implementation
+ PImpl* _pimpl;
};