Fix emitter leaks, style, tree swaps

This commit is contained in:
Thomas Nordquist
2019-01-22 12:17:59 +01:00
parent 221abd8c48
commit d4ce58a8ec
22 changed files with 411 additions and 164 deletions

View File

@@ -18,7 +18,14 @@ export class Edge implements Hashable {
public hash(): string {
if (!this.cachedHash) {
const previousHash = (this.source && this.source.sourceEdge) ? this.source.sourceEdge.hash() : ''
let previousHash
if (this.source && this.source.sourceEdge) {
previousHash = this.source.sourceEdge.hash()
} else {
// Use the tree hash to distinguish between different trees
previousHash = this.source && this.source.isTree ? (this.source as any).hash() : ''
}
this.cachedHash = `H${sha1(previousHash + this.name)}`
}