Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/fixtures/review/nested-services-2.ts
13399 views
1
class InstantiationService2 {
2
3
private readonly _children = new Set<InstantiationService2>();
4
5
constructor(private readonly _parent?: InstantiationService2) {}
6
7
createChild(): InstantiationService2 {
8
const child = new class extends InstantiationService2 {
9
override dispose(): void {
10
if (this._parent) {
11
this._parent._children.delete(this);
12
}
13
super.dispose();
14
}
15
}(this);
16
this._children.add(child);
17
18
return child;
19
}
20
21
dispose(): void {
22
this._children.forEach(child => child.dispose());
23
}
24
}
25