aboutsummaryrefslogtreecommitdiffstats
path: root/typing.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-19 03:11:33 +0000
committerDavid Robillard <d@drobilla.net>2009-06-19 03:11:33 +0000
commit855456a9d98c5c27bb2b00bab4018630598117fa (patch)
tree8c13f757d5439558cba32eb0db050d76788b7a92 /typing.cpp
parent450137a8283cdc123b22a884d6af7fef2f3aae76 (diff)
downloadresp-855456a9d98c5c27bb2b00bab4018630598117fa.tar.gz
resp-855456a9d98c5c27bb2b00bab4018630598117fa.tar.bz2
resp-855456a9d98c5c27bb2b00bab4018630598117fa.zip
Primitive garbage collector for AST nodes.
Fix memory leaks. git-svn-id: http://svn.drobilla.net/resp/tuplr@123 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'typing.cpp')
-rw-r--r--typing.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/typing.cpp b/typing.cpp
index 8487001..fd8e35e 100644
--- a/typing.cpp
+++ b/typing.cpp
@@ -108,9 +108,10 @@ AClosure::constrain(TEnv& tenv, Constraints& c) const
genericType = new AType(loc, tenv.penv.sym("Fn"),
tsubst.apply(protT), tsubst.apply(bodyT), 0);
tenv.genericTypes.insert(make_pair(this, genericType));
+ AST::pool.addRoot(genericType);
tenv.pop();
- subst = new Subst(tsubst);
+ subst = tsubst;
}
c.constrain(tenv, this, new AType(*genericType));
@@ -283,7 +284,7 @@ Subst::compose(const Subst& delta, const Subst& gamma) // TAPL 22.1.1
{
Subst r;
for (Subst::const_iterator g = gamma.begin(); g != gamma.end(); ++g) {
- Subst::const_iterator d = delta.find(*g->second);
+ Subst::const_iterator d = delta.find(g->second);
r.insert(make_pair(g->first, ((d != delta.end()) ? d : g)->second));
}
for (Subst::const_iterator d = delta.begin(); d != delta.end(); ++d) {