mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Remove getBucketForCompilationSettings (#28088)
This commit is contained in:
parent
854f20e90f
commit
e46c846ee6
@ -121,14 +121,6 @@ namespace ts {
|
||||
const buckets = createMap<Map<DocumentRegistryEntry>>();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
|
||||
|
||||
function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): Map<DocumentRegistryEntry> {
|
||||
let bucket = buckets.get(key);
|
||||
if (!bucket && createIfMissing) {
|
||||
buckets.set(key, bucket = createMap<DocumentRegistryEntry>());
|
||||
}
|
||||
return bucket!; // TODO: GH#18217
|
||||
}
|
||||
|
||||
function reportStats() {
|
||||
const bucketInfoArray = arrayFrom(buckets.keys()).filter(name => name && name.charAt(0) === "_").map(name => {
|
||||
const entries = buckets.get(name)!;
|
||||
@ -178,7 +170,7 @@ namespace ts {
|
||||
acquiring: boolean,
|
||||
scriptKind?: ScriptKind): SourceFile {
|
||||
|
||||
const bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true);
|
||||
const bucket = getOrUpdate<Map<DocumentRegistryEntry>>(buckets, key, createMap);
|
||||
let entry = bucket.get(path);
|
||||
const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : compilationSettings.target || ScriptTarget.ES5;
|
||||
if (!entry && externalCache) {
|
||||
@ -238,9 +230,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey): void {
|
||||
const bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false);
|
||||
Debug.assert(bucket !== undefined);
|
||||
|
||||
const bucket = Debug.assertDefined(buckets.get(key));
|
||||
const entry = bucket.get(path)!;
|
||||
entry.languageServiceRefCount--;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user