Skip to content

Commit 09e1c92

Browse files
author
Andy Hanson
committed
Renames
1 parent e2a0931 commit 09e1c92

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/compiler/program.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ namespace ts {
479479
// Maps from a SourceFile's `.path` to the name of the package it was imported with.
480480
let sourceFileToPackageName = createMap<string>();
481481
// See `sourceFileIsRedirectedTo`.
482-
let isSourceFileTargetOfRedirect = createMap<true>();
482+
let redirectTargetsSet = createMap<true>();
483483

484484
const filesByName = createMap<SourceFile | undefined>();
485485
// stores 'filename -> file association' ignoring case
@@ -558,7 +558,7 @@ namespace ts {
558558
dropDiagnosticsProducingTypeChecker,
559559
getSourceFileFromReference,
560560
sourceFileToPackageName,
561-
isSourceFileTargetOfRedirect,
561+
redirectTargetsSet,
562562
};
563563

564564
verifyCompilerOptions();
@@ -797,12 +797,12 @@ namespace ts {
797797
if (oldSourceFile.redirect) {
798798
// We got `newSourceFile` by path, so it is actually for the underlying file.
799799
// This lets us know if the underlying file has changed. If it has we should break the redirect.
800-
if (newSourceFile !== oldSourceFile.redirect.underlying) {
800+
if (newSourceFile !== oldSourceFile.redirect.unredirected) {
801801
// Underlying file has changed. Might not redirect anymore. Must rebuild program.
802802
return oldProgram.structureIsReused = StructureIsReused.Not;
803803
}
804804
}
805-
else if (oldProgram.isSourceFileTargetOfRedirect.has(oldSourceFile.path)) {
805+
else if (oldProgram.redirectTargetsSet.has(oldSourceFile.path)) {
806806
// This is similar to the above case. If a redirected-to source file changes, the redirect may be broken.
807807
if (newSourceFile !== oldSourceFile) {
808808
return oldProgram.structureIsReused = StructureIsReused.Not;
@@ -941,7 +941,7 @@ namespace ts {
941941
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
942942

943943
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
944-
isSourceFileTargetOfRedirect = oldProgram.isSourceFileTargetOfRedirect;
944+
redirectTargetsSet = oldProgram.redirectTargetsSet;
945945

946946
return oldProgram.structureIsReused = StructureIsReused.Completely;
947947
}
@@ -1597,19 +1597,19 @@ namespace ts {
15971597
}
15981598
}
15991599

1600-
function createRedirectSourceFile(redirectTo: SourceFile, underlying: SourceFile, fileName: string, path: Path): SourceFile {
1601-
const redirect: SourceFile = Object.create(redirectTo);
1600+
function createRedirectSourceFile(redirectTarget: SourceFile, unredirected: SourceFile, fileName: string, path: Path): SourceFile {
1601+
const redirect: SourceFile = Object.create(redirectTarget);
16021602
redirect.fileName = fileName;
16031603
redirect.path = path;
1604-
redirect.redirect = { redirectTo, underlying };
1604+
redirect.redirect = { redirectTarget, unredirected };
16051605
Object.defineProperties(redirect, {
16061606
id: {
1607-
get(this: SourceFile) { return this.redirect.redirectTo.id; },
1608-
set(this: SourceFile, value: SourceFile["id"]) { this.redirect.redirectTo.id = value; },
1607+
get(this: SourceFile) { return this.redirect.redirectTarget.id; },
1608+
set(this: SourceFile, value: SourceFile["id"]) { this.redirect.redirectTarget.id = value; },
16091609
},
16101610
symbol: {
1611-
get(this: SourceFile) { return this.redirect.redirectTo.symbol; },
1612-
set(this: SourceFile, value: SourceFile["symbol"]) { this.redirect.redirectTo.symbol = value; },
1611+
get(this: SourceFile) { return this.redirect.redirectTarget.symbol; },
1612+
set(this: SourceFile, value: SourceFile["symbol"]) { this.redirect.redirectTarget.symbol = value; },
16131613
},
16141614
});
16151615
return redirect;
@@ -1666,7 +1666,7 @@ namespace ts {
16661666
// Some other SourceFile already exists with this package name and version.
16671667
// Instead of creating a duplicate, just redirect to the existing one.
16681668
const dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path);
1669-
isSourceFileTargetOfRedirect.set(fileFromPackageId.path, true);
1669+
redirectTargetsSet.set(fileFromPackageId.path, true);
16701670
filesByName.set(path, dupFile);
16711671
sourceFileToPackageName.set(path, packageId.name);
16721672
files.push(dupFile);

src/compiler/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,12 +2330,12 @@ namespace ts {
23302330
*/
23312331
/* @internal */ redirect?: {
23322332
/** Source file this redirects to. */
2333-
readonly redirectTo: SourceFile,
2333+
readonly redirectTarget: SourceFile,
23342334
/**
23352335
* Source file for the duplicate package. This will not be used by the Program,
23362336
* but we need to keep this around so we can watch for changes in underlying.
23372337
*/
2338-
readonly underlying: SourceFile,
2338+
readonly unredirected: SourceFile,
23392339
} | undefined;
23402340

23412341
amdDependencies: AmdDependency[];
@@ -2511,8 +2511,8 @@ namespace ts {
25112511

25122512
/** Given a source file, get the name of the package it was imported from. */
25132513
/* @internal */ sourceFileToPackageName: Map<string>;
2514-
/** True if some other source file redirects to this one. */
2515-
/* @internal */ isSourceFileTargetOfRedirect: Map<true>;
2514+
/** Set of all source files that some other source file redirects to. */
2515+
/* @internal */ redirectTargetsSet: Map<true>;
25162516
}
25172517

25182518
/* @internal */

src/harness/unittests/reuseProgramStructure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace ts {
110110
const files = arrayToMap(texts, t => t.name, t => {
111111
if (oldProgram) {
112112
let oldFile = <SourceFileWithText>oldProgram.getSourceFile(t.name);
113-
if (oldFile && oldFile.redirect) oldFile = oldFile.redirect.underlying;
113+
if (oldFile && oldFile.redirect) oldFile = oldFile.redirect.unredirected;
114114
if (oldFile && oldFile.sourceText.getVersion() === t.text.getVersion()) {
115115
return oldFile;
116116
}

0 commit comments

Comments
 (0)