Skip to content

Commit ad1cebc

Browse files
committed
When checking for incremental correctness always calculate signature
1 parent b1fb729 commit ad1cebc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/compiler/builder.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ namespace ts {
348348
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
349349
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
350350
*/
351-
function getNextAffectedFile(state: BuilderProgramState, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash): SourceFile | Program | undefined {
351+
function getNextAffectedFile(state: BuilderProgramState, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash, host: BuilderProgramHost): SourceFile | Program | undefined {
352352
while (true) {
353353
const { affectedFiles } = state;
354354
if (affectedFiles) {
@@ -359,7 +359,7 @@ namespace ts {
359359
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
360360
// Set the next affected file as seen and remove the cached semantic diagnostics
361361
state.affectedFilesIndex = affectedFilesIndex;
362-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
362+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
363363
return affectedFile;
364364
}
365365
affectedFilesIndex++;
@@ -433,7 +433,7 @@ namespace ts {
433433
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
434434
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
435435
*/
436-
function handleDtsMayChangeOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash) {
436+
function handleDtsMayChangeOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash, host: BuilderProgramHost) {
437437
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
438438

439439
// If affected files is everything except default library, then nothing more to do
@@ -467,15 +467,15 @@ namespace ts {
467467
}
468468

469469
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
470-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash));
470+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host));
471471
}
472472
}
473473

474474
/**
475475
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
476476
* Also we need to make sure signature is updated for these files
477477
*/
478-
function handleDtsMayChangeOf(state: BuilderProgramState, path: Path, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash): void {
478+
function handleDtsMayChangeOf(state: BuilderProgramState, path: Path, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash, host: BuilderProgramHost): void {
479479
removeSemanticDiagnosticsOf(state, path);
480480

481481
if (!state.changedFilesSet.has(path)) {
@@ -495,7 +495,7 @@ namespace ts {
495495
cancellationToken,
496496
computeHash,
497497
state.currentAffectedFilesExportedModulesMap,
498-
/* useFileVersionAsSignature */ true
498+
!host.disableUseFileVersionAsSignature
499499
);
500500
// If not dts emit, nothing more to do
501501
if (getEmitDeclarations(state.compilerOptions)) {
@@ -1039,7 +1039,7 @@ namespace ts {
10391039
* in that order would be used to write the files
10401040
*/
10411041
function emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult<EmitResult> {
1042-
let affected = getNextAffectedFile(state, cancellationToken, computeHash);
1042+
let affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
10431043
let emitKind = BuilderFileEmit.Full;
10441044
let isPendingEmitFile = false;
10451045
if (!affected) {
@@ -1162,7 +1162,7 @@ namespace ts {
11621162
*/
11631163
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult<readonly Diagnostic[]> {
11641164
while (true) {
1165-
const affected = getNextAffectedFile(state, cancellationToken, computeHash);
1165+
const affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
11661166
if (!affected) {
11671167
// Done
11681168
return undefined;

0 commit comments

Comments
 (0)