Skip to content

Commit 0a23381

Browse files
committed
Check directly for forceDtsEmit before getting diagnostics and returning emitResolver
1 parent 5cc1ea4 commit 0a23381

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/compiler/checker.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
24312431
function getEmitResolver(sourceFile: SourceFile, cancellationToken: CancellationToken, forceDtsEmit?: boolean) {
24322432
// Ensure we have all the type information in place for this file so that all the
24332433
// emitter questions of this resolver will return the right information.
2434-
getDiagnostics(sourceFile, cancellationToken, forceDtsEmit);
2434+
if (!forceDtsEmit) getDiagnostics(sourceFile, cancellationToken);
24352435
return emitResolver;
24362436
}
24372437

@@ -47483,10 +47483,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4748347483
tracing?.pop();
4748447484
}
4748547485

47486-
function checkSourceFile(node: SourceFile, forceDtsEmit: boolean | undefined) {
47486+
function checkSourceFile(node: SourceFile) {
4748747487
tracing?.push(tracing.Phase.Check, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true);
4748847488
performance.mark("beforeCheck");
47489-
checkSourceFileWorker(node, forceDtsEmit);
47489+
checkSourceFileWorker(node);
4749047490
performance.mark("afterCheck");
4749147491
performance.measure("Check", "beforeCheck", "afterCheck");
4749247492
tracing?.pop();
@@ -47511,10 +47511,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4751147511
}
4751247512

4751347513
// Fully type check a source file and collect the relevant diagnostics.
47514-
function checkSourceFileWorker(node: SourceFile, forceDtsEmit: boolean | undefined) {
47514+
function checkSourceFileWorker(node: SourceFile) {
4751547515
const links = getNodeLinks(node);
4751647516
if (!(links.flags & NodeCheckFlags.TypeChecked)) {
47517-
if (forceDtsEmit || skipTypeChecking(node, compilerOptions, host)) {
47517+
if (skipTypeChecking(node, compilerOptions, host)) {
4751847518
return;
4751947519
}
4752047520

@@ -47578,13 +47578,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4757847578
}
4757947579
}
4758047580

47581-
function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken, forceDtsEmit?: boolean): Diagnostic[] {
47581+
function getDiagnostics(sourceFile: SourceFile, ct: CancellationToken): Diagnostic[] {
4758247582
try {
4758347583
// Record the cancellation token so it can be checked later on during checkSourceElement.
4758447584
// Do this in a finally block so we can ensure that it gets reset back to nothing after
4758547585
// this call is done.
4758647586
cancellationToken = ct;
47587-
return getDiagnosticsWorker(sourceFile, forceDtsEmit);
47587+
return getDiagnosticsWorker(sourceFile);
4758847588
}
4758947589
finally {
4759047590
cancellationToken = undefined;
@@ -47599,7 +47599,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4759947599
deferredDiagnosticsCallbacks = [];
4760047600
}
4760147601

47602-
function checkSourceFileWithEagerDiagnostics(sourceFile: SourceFile, forceDtsEmit?: boolean) {
47602+
function checkSourceFileWithEagerDiagnostics(sourceFile: SourceFile) {
4760347603
ensurePendingDiagnosticWorkComplete();
4760447604
// then setup diagnostics for immediate invocation (as we are about to collect them, and
4760547605
// this avoids the overhead of longer-lived callbacks we don't need to allocate)
@@ -47608,11 +47608,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4760847608
// thus much more likely retaining the same union ordering as before we had lazy diagnostics)
4760947609
const oldAddLazyDiagnostics = addLazyDiagnostic;
4761047610
addLazyDiagnostic = cb => cb();
47611-
checkSourceFile(sourceFile, forceDtsEmit);
47611+
checkSourceFile(sourceFile);
4761247612
addLazyDiagnostic = oldAddLazyDiagnostics;
4761347613
}
4761447614

47615-
function getDiagnosticsWorker(sourceFile: SourceFile, forceDtsEmit: boolean | undefined): Diagnostic[] {
47615+
function getDiagnosticsWorker(sourceFile: SourceFile): Diagnostic[] {
4761647616
if (sourceFile) {
4761747617
ensurePendingDiagnosticWorkComplete();
4761847618
// Some global diagnostics are deferred until they are needed and
@@ -47621,7 +47621,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4762147621
const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
4762247622
const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
4762347623

47624-
checkSourceFileWithEagerDiagnostics(sourceFile, forceDtsEmit);
47624+
checkSourceFileWithEagerDiagnostics(sourceFile);
4762547625

4762647626
const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
4762747627
const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
@@ -47642,7 +47642,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4764247642

4764347643
// Global diagnostics are always added when a file is not provided to
4764447644
// getDiagnostics
47645-
forEach(host.getSourceFiles(), sourceFile => checkSourceFileWithEagerDiagnostics(sourceFile, forceDtsEmit));
47645+
forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
4764647646
return diagnostics.getDiagnostics();
4764747647
}
4764847648

0 commit comments

Comments
 (0)