@@ -13338,7 +13338,7 @@ namespace ts {
13338
13338
// caps union types at 1000 unique object types.
13339
13339
const estimatedCount = (count / (len - i)) * len;
13340
13340
if (estimatedCount > 1000000) {
13341
- tracing.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map(t => t.id) });
13341
+ tracing? .instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map(t => t.id) });
13342
13342
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
13343
13343
return false;
13344
13344
}
@@ -13817,7 +13817,7 @@ namespace ts {
13817
13817
function checkCrossProductUnion(types: readonly Type[]) {
13818
13818
const size = getCrossProductUnionSize(types);
13819
13819
if (size >= 100000) {
13820
- tracing.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map(t => t.id), size });
13820
+ tracing? .instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map(t => t.id), size });
13821
13821
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
13822
13822
return false;
13823
13823
}
@@ -15751,7 +15751,7 @@ namespace ts {
15751
15751
// We have reached 50 recursive type instantiations and there is a very high likelyhood we're dealing
15752
15752
// with a combination of infinite generic types that perpetually generate new type identities. We stop
15753
15753
// the recursion here by yielding the error type.
15754
- tracing.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
15754
+ tracing? .instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount });
15755
15755
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
15756
15756
return errorType;
15757
15757
}
@@ -16881,7 +16881,7 @@ namespace ts {
16881
16881
reportIncompatibleStack();
16882
16882
}
16883
16883
if (overflow) {
16884
- tracing.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth });
16884
+ tracing? .instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth });
16885
16885
const diag = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
16886
16886
if (errorOutputContainer) {
16887
16887
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -17368,7 +17368,7 @@ namespace ts {
17368
17368
}
17369
17369
17370
17370
function traceUnionsOrIntersectionsTooLarge(source: Type, target: Type): void {
17371
- if (!tracing.isTracing() ) {
17371
+ if (!tracing) {
17372
17372
return;
17373
17373
}
17374
17374
@@ -17730,7 +17730,7 @@ namespace ts {
17730
17730
}
17731
17731
17732
17732
if (expandingFlags === ExpandingFlags.Both) {
17733
- tracing.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
17733
+ tracing? .instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
17734
17734
sourceId: source.id,
17735
17735
sourceIdStack: sourceStack.map(t => t.id),
17736
17736
targetId: target.id,
@@ -17767,9 +17767,9 @@ namespace ts {
17767
17767
}
17768
17768
17769
17769
function structuredTypeRelatedTo(source: Type, target: Type, reportErrors: boolean, intersectionState: IntersectionState): Ternary {
17770
- tracing.push(tracing.Phase.CheckTypes, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
17770
+ tracing? .push(tracing.Phase.CheckTypes, "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
17771
17771
const result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
17772
- tracing.pop();
17772
+ tracing? .pop();
17773
17773
return result;
17774
17774
}
17775
17775
@@ -18294,7 +18294,7 @@ namespace ts {
18294
18294
numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
18295
18295
if (numCombinations > 25) {
18296
18296
// We've reached the complexity limit.
18297
- tracing.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations });
18297
+ tracing? .instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source.id, targetId: target.id, numCombinations });
18298
18298
return Ternary.False;
18299
18299
}
18300
18300
}
@@ -19073,7 +19073,7 @@ namespace ts {
19073
19073
function getVariancesWorker<TCache extends { variances?: VarianceFlags[] }>(typeParameters: readonly TypeParameter[] = emptyArray, cache: TCache, createMarkerType: (input: TCache, param: TypeParameter, marker: Type) => Type): VarianceFlags[] {
19074
19074
let variances = cache.variances;
19075
19075
if (!variances) {
19076
- tracing.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: (cache as any).id ?? (cache as any).declaredType?.id ?? -1 });
19076
+ tracing? .push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: (cache as any).id ?? (cache as any).declaredType?.id ?? -1 });
19077
19077
// The emptyArray singleton is used to signal a recursive invocation.
19078
19078
cache.variances = emptyArray;
19079
19079
variances = [];
@@ -19108,7 +19108,7 @@ namespace ts {
19108
19108
variances.push(variance);
19109
19109
}
19110
19110
cache.variances = variances;
19111
- tracing.pop();
19111
+ tracing? .pop();
19112
19112
}
19113
19113
return variances;
19114
19114
}
@@ -22199,7 +22199,7 @@ namespace ts {
22199
22199
if (flowDepth === 2000) {
22200
22200
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
22201
22201
// and disable further control flow analysis in the containing function or module body.
22202
- tracing.instant(tracing.Phase.CheckTypes, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
22202
+ tracing? .instant(tracing.Phase.CheckTypes, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id });
22203
22203
flowAnalysisDisabled = true;
22204
22204
reportFlowControlError(reference);
22205
22205
return errorType;
@@ -31673,7 +31673,7 @@ namespace ts {
31673
31673
}
31674
31674
31675
31675
function checkExpression(node: Expression | QualifiedName, checkMode?: CheckMode, forceTuple?: boolean): Type {
31676
- tracing.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
31676
+ tracing? .push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
31677
31677
const saveCurrentNode = currentNode;
31678
31678
currentNode = node;
31679
31679
instantiationCount = 0;
@@ -31683,7 +31683,7 @@ namespace ts {
31683
31683
checkConstEnumAccess(node, type);
31684
31684
}
31685
31685
currentNode = saveCurrentNode;
31686
- tracing.pop();
31686
+ tracing? .pop();
31687
31687
return type;
31688
31688
}
31689
31689
@@ -34489,10 +34489,10 @@ namespace ts {
34489
34489
}
34490
34490
34491
34491
function checkVariableDeclaration(node: VariableDeclaration) {
34492
- tracing.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
34492
+ tracing? .push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
34493
34493
checkGrammarVariableDeclaration(node);
34494
34494
checkVariableLikeDeclaration(node);
34495
- tracing.pop();
34495
+ tracing? .pop();
34496
34496
}
34497
34497
34498
34498
function checkBindingElement(node: BindingElement) {
@@ -37570,7 +37570,7 @@ namespace ts {
37570
37570
}
37571
37571
37572
37572
function checkDeferredNode(node: Node) {
37573
- tracing.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
37573
+ tracing? .push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
37574
37574
const saveCurrentNode = currentNode;
37575
37575
currentNode = node;
37576
37576
instantiationCount = 0;
@@ -37606,16 +37606,16 @@ namespace ts {
37606
37606
break;
37607
37607
}
37608
37608
currentNode = saveCurrentNode;
37609
- tracing.pop();
37609
+ tracing? .pop();
37610
37610
}
37611
37611
37612
37612
function checkSourceFile(node: SourceFile) {
37613
- tracing.push(tracing.Phase.Check, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true);
37613
+ tracing? .push(tracing.Phase.Check, "checkSourceFile", { path: node.path }, /*separateBeginAndEnd*/ true);
37614
37614
performance.mark("beforeCheck");
37615
37615
checkSourceFileWorker(node);
37616
37616
performance.mark("afterCheck");
37617
37617
performance.measure("Check", "beforeCheck", "afterCheck");
37618
- tracing.pop();
37618
+ tracing? .pop();
37619
37619
}
37620
37620
37621
37621
function unusedIsError(kind: UnusedKind, isAmbient: boolean): boolean {
0 commit comments