mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
debt - use Map instead of object
This commit is contained in:
@@ -10,20 +10,20 @@ export class ExtHostHeapService extends ExtHostHeapServiceShape {
|
||||
|
||||
private static _idPool = 0;
|
||||
|
||||
private _data: { [n: number]: any } = Object.create(null);
|
||||
private _data = new Map<number, any>();
|
||||
|
||||
keep(obj: any): number {
|
||||
const id = ExtHostHeapService._idPool++;
|
||||
this._data[id] = obj;
|
||||
this._data.set(id, obj);
|
||||
return id;
|
||||
}
|
||||
|
||||
delete(id: number): boolean {
|
||||
return this._data[id];
|
||||
return this._data.delete(id);
|
||||
}
|
||||
|
||||
get<T>(id: number): T {
|
||||
return this._data[id];
|
||||
return this._data.get(id);
|
||||
}
|
||||
|
||||
$onGarbageCollection(ids: number[]): void {
|
||||
@@ -31,4 +31,4 @@ export class ExtHostHeapService extends ExtHostHeapServiceShape {
|
||||
this.delete(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user