Skip to content

Commit

Permalink
print trace for potential cycle, #124723 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 31, 2021
1 parent 8b04a82 commit 692fb8a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/vs/base/common/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,21 +497,25 @@ export class TernarySearchTree<K, V> {
yield* this._entries(this._root);
}

private *_entries(node: TernarySearchTreeNode<K, V> | undefined): IterableIterator<[K, V]> {
private *_entries(node: TernarySearchTreeNode<K, V> | undefined, i: number = 0): IterableIterator<[K, V]> {
if (i > 5000) {
console.trace('potential CYCLE detected');
return;
}
if (node) {
// left
yield* this._entries(node.left);
yield* this._entries(node.left, i++);

// node
if (node.value) {
// callback(node.value, this._iter.join(parts));
yield [node.key, node.value];
}
// mid
yield* this._entries(node.mid);
yield* this._entries(node.mid, i++);

// right
yield* this._entries(node.right);
yield* this._entries(node.right, i++);
}
}
}
Expand Down

0 comments on commit 692fb8a

Please sign in to comment.