mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 11:10:48 +00:00
print trace for potential cycle, https://github.com/microsoft/vscode/issues/124723#issuecomment-850674813
This commit is contained in:
parent
4f3d865a6b
commit
910d70bb88
1 changed files with 8 additions and 4 deletions
|
@ -497,10 +497,14 @@ 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) {
|
||||
|
@ -508,10 +512,10 @@ export class TernarySearchTree<K, V> {
|
|||
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++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue