Code review feedback

This commit is contained in:
Sheetal Nandi 2019-04-17 16:32:33 -07:00
parent ae7e00e741
commit 4a55025f20
2 changed files with 16 additions and 5 deletions

View File

@ -406,14 +406,13 @@ namespace ts {
}
/**
* Handles sematic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
* Similar to cleanSemanticDiagnosticsOfAffectedFile
*/
function handleDtsMayChangeOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash) {
removeSemanticDiagnosticsOf(state, affectedFile.path);
// If affected files is everything except default librarry, then nothing more to do
// If affected files is everything except default library, then nothing more to do
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
@ -442,7 +441,19 @@ namespace ts {
const program = Debug.assertDefined(state.program);
const sourceFile = program.getSourceFileByPath(path);
if (sourceFile) {
BuilderState.updateShapeSignature(state, program, sourceFile, Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
// Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
// we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
// This ensures that we dont later during incremental builds considering wrong signature.
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
BuilderState.updateShapeSignature(
state,
program,
sourceFile,
Debug.assertDefined(state.currentAffectedFilesSignatures),
cancellationToken,
computeHash,
state.currentAffectedFilesExportedModulesMap
);
// If not dts emit, nothing more to do
if (getEmitDeclarations(state.compilerOptions)) {
addToAffectedFilesPendingEmit(state, [path]);

View File

@ -92,7 +92,7 @@
"unittests/tsbuild/amdModulesWithOut.ts",
"unittests/tsbuild/emptyFiles.ts",
"unittests/tsbuild/graphOrdering.ts",
"unittests/tsbuild//inferredTypeFromTransitiveModule.ts",
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
"unittests/tsbuild/missingExtendedFile.ts",
"unittests/tsbuild/outFile.ts",
"unittests/tsbuild/referencesWithRootDirInParent.ts",