Allow trackobject to take undefined

This commit is contained in:
Matt Bierner
2019-03-07 11:48:21 -08:00
parent a92031dc02
commit 8ee3c9a484
2 changed files with 4 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ export interface IHeapService {
/**
* Track gc-collection for the given object
*/
trackObject(obj: ObjectIdentifier): void;
trackObject(obj: ObjectIdentifier | undefined): void;
}
export class HeapService implements IHeapService {

View File

@@ -137,9 +137,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
if (dto) {
dto.forEach(obj => {
this._heapService.trackObject(obj);
if (obj.command) {
this._heapService.trackObject(obj.command);
}
this._heapService.trackObject(obj.command);
});
}
return dto;
@@ -149,9 +147,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return this._proxy.$resolveCodeLens(handle, model.uri, codeLens, token).then(obj => {
if (obj) {
this._heapService.trackObject(obj);
if (obj.command) {
this._heapService.trackObject(obj.command);
}
this._heapService.trackObject(obj.command);
}
return obj;
});
@@ -274,11 +270,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
provideCodeActions: (model: ITextModel, rangeOrSelection: EditorRange | Selection, context: modes.CodeActionContext, token: CancellationToken): Promise<modes.CodeAction[]> => {
return this._proxy.$provideCodeActions(handle, model.uri, rangeOrSelection, context, token).then(dto => {
if (dto) {
dto.forEach(obj => {
if (obj.command) {
this._heapService.trackObject(obj.command);
}
});
dto.forEach(obj => { this._heapService.trackObject(obj.command); });
}
return MainThreadLanguageFeatures._reviveCodeActionDto(dto);
});