started implementing the garbage collector

This commit is contained in:
Kevin Jahns
2015-07-26 03:13:13 +00:00
parent dae0f71cbc
commit c8ded24842
10 changed files with 106 additions and 21 deletions

View File

@@ -31,6 +31,18 @@ var Struct = {
var target = yield* this.getOperation(op.target)
if (!target.deleted) {
target.deleted = true
if (target.left !== null && (yield* this.getOperation(target.left)).deleted) {
this.store.addToGarbageCollector(target.id)
target.gc = true
}
if (target.right !== null) {
var right = yield* this.getOperation(target.right)
if (right.deleted && right.gc == null) {
this.store.addToGarbageCollector(right.id)
right.gc = true
yield* this.setOperation(right)
}
}
yield* this.setOperation(target)
this.ds.delete(target.id)
var t = this.store.initializedTypes[JSON.stringify(target.parent)]