Require second parameter for Map.set

Converts cover the was relying on the old signature to either use delete or have the correct types
This commit is contained in:
Matt Bierner
2020-01-06 11:41:33 -08:00
parent ab75933a8b
commit af9dddd0fc
6 changed files with 20 additions and 7 deletions

View File

@@ -16,8 +16,13 @@ import { equals } from 'vs/base/common/arrays';
const _modeId2WordDefinition = new Map<string, RegExp>();
export function setWordDefinitionFor(modeId: string, wordDefinition: RegExp | undefined): void {
_modeId2WordDefinition.set(modeId, wordDefinition);
if (!wordDefinition) {
_modeId2WordDefinition.delete(modeId);
} else {
_modeId2WordDefinition.set(modeId, wordDefinition);
}
}
export function getWordDefinitionFor(modeId: string): RegExp | undefined {
return _modeId2WordDefinition.get(modeId);
}