Don't leak cloned closures/continuations

Instead of appending the new closure to the end of the list,
the list was being cleared, and then the new closure was added.

Most closures only get one clone (since we don't yet support bind)
but occaisionally, closures (or continuations in closures) inside
traits can end up with more than one. In that case, we ping-pong
between the different clones, generating new clones, and new code
as we go.
Esse commit está contido em:
Mark Williams
2013-05-02 15:26:23 -07:00
commit de Sara Golemon
commit 270227c36c
+4 -4
Ver Arquivo
@@ -270,11 +270,11 @@ const Func* Func::cloneAndSetClass(Class* cls) const {
clonedFunc->setCls(cls);
// Save it so we don't have to keep cloning it and retranslating
Func*& nextFunc = this->nextClonedClosure();
while (nextFunc) {
nextFunc = nextFunc->nextClonedClosure();
Func** nextFunc = &this->nextClonedClosure();
while (*nextFunc) {
nextFunc = &nextFunc[0]->nextClonedClosure();
}
nextFunc = clonedFunc;
*nextFunc = clonedFunc;
return clonedFunc;
}