Use o for paramter names

This aligns with the standard lib typings which usually use `o` for object types
This commit is contained in:
Matt Bierner 2021-07-20 17:20:40 -07:00
parent a80ad998c0
commit 2cddf0f039
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -210,24 +210,24 @@ export class DisposableStore implements IDisposable {
}
}
public add<T extends IDisposable>(t: T): T {
if (!t) {
return t;
public add<T extends IDisposable>(o: T): T {
if (!o) {
return o;
}
if ((t as unknown as DisposableStore) === this) {
if ((o as unknown as DisposableStore) === this) {
throw new Error('Cannot register a disposable on itself!');
}
setParentOfDisposable(t, this);
setParentOfDisposable(o, this);
if (this._isDisposed) {
if (!DisposableStore.DISABLE_DISPOSED_WARNING) {
console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);
}
} else {
this._toDispose.add(t);
this._toDispose.add(o);
}
return t;
return o;
}
}
@ -248,11 +248,11 @@ export abstract class Disposable implements IDisposable {
this._store.dispose();
}
protected _register<T extends IDisposable>(t: T): T {
if ((t as unknown as Disposable) === this) {
protected _register<T extends IDisposable>(o: T): T {
if ((o as unknown as Disposable) === this) {
throw new Error('Cannot register a disposable on itself!');
}
return this._store.add(t);
return this._store.add(o);
}
}