@@ -13338,7 +13338,7 @@ namespace ts {
1333813338 // caps union types at 1000 unique object types.
1333913339 const estimatedCount = (count / (len - i)) * len;
1334013340 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) });
1334213342 error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
1334313343 return false;
1334413344 }
@@ -13817,7 +13817,7 @@ namespace ts {
1381713817 function checkCrossProductUnion(types: readonly Type[]) {
1381813818 const size = getCrossProductUnionSize(types);
1381913819 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 });
1382113821 error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
1382213822 return false;
1382313823 }
@@ -15751,7 +15751,7 @@ namespace ts {
1575115751 // We have reached 50 recursive type instantiations and there is a very high likelyhood we're dealing
1575215752 // with a combination of infinite generic types that perpetually generate new type identities. We stop
1575315753 // 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 });
1575515755 error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
1575615756 return errorType;
1575715757 }
@@ -16881,7 +16881,7 @@ namespace ts {
1688116881 reportIncompatibleStack();
1688216882 }
1688316883 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 });
1688516885 const diag = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
1688616886 if (errorOutputContainer) {
1688716887 (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -17368,7 +17368,7 @@ namespace ts {
1736817368 }
1736917369
1737017370 function traceUnionsOrIntersectionsTooLarge(source: Type, target: Type): void {
17371- if (!tracing.isTracing() ) {
17371+ if (!tracing) {
1737217372 return;
1737317373 }
1737417374
@@ -17730,7 +17730,7 @@ namespace ts {
1773017730 }
1773117731
1773217732 if (expandingFlags === ExpandingFlags.Both) {
17733- tracing.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
17733+ tracing? .instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", {
1773417734 sourceId: source.id,
1773517735 sourceIdStack: sourceStack.map(t => t.id),
1773617736 targetId: target.id,
@@ -17767,9 +17767,9 @@ namespace ts {
1776717767 }
1776817768
1776917769 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 });
1777117771 const result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
17772- tracing.pop();
17772+ tracing? .pop();
1777317773 return result;
1777417774 }
1777517775
@@ -18294,7 +18294,7 @@ namespace ts {
1829418294 numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
1829518295 if (numCombinations > 25) {
1829618296 // 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 });
1829818298 return Ternary.False;
1829918299 }
1830018300 }
@@ -19073,7 +19073,7 @@ namespace ts {
1907319073 function getVariancesWorker<TCache extends { variances?: VarianceFlags[] }>(typeParameters: readonly TypeParameter[] = emptyArray, cache: TCache, createMarkerType: (input: TCache, param: TypeParameter, marker: Type) => Type): VarianceFlags[] {
1907419074 let variances = cache.variances;
1907519075 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 });
1907719077 // The emptyArray singleton is used to signal a recursive invocation.
1907819078 cache.variances = emptyArray;
1907919079 variances = [];
@@ -19108,7 +19108,7 @@ namespace ts {
1910819108 variances.push(variance);
1910919109 }
1911019110 cache.variances = variances;
19111- tracing.pop();
19111+ tracing? .pop();
1911219112 }
1911319113 return variances;
1911419114 }
@@ -22199,7 +22199,7 @@ namespace ts {
2219922199 if (flowDepth === 2000) {
2220022200 // We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
2220122201 // 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 });
2220322203 flowAnalysisDisabled = true;
2220422204 reportFlowControlError(reference);
2220522205 return errorType;
@@ -31673,7 +31673,7 @@ namespace ts {
3167331673 }
3167431674
3167531675 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 });
3167731677 const saveCurrentNode = currentNode;
3167831678 currentNode = node;
3167931679 instantiationCount = 0;
@@ -31683,7 +31683,7 @@ namespace ts {
3168331683 checkConstEnumAccess(node, type);
3168431684 }
3168531685 currentNode = saveCurrentNode;
31686- tracing.pop();
31686+ tracing? .pop();
3168731687 return type;
3168831688 }
3168931689
@@ -34489,10 +34489,10 @@ namespace ts {
3448934489 }
3449034490
3449134491 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 });
3449334493 checkGrammarVariableDeclaration(node);
3449434494 checkVariableLikeDeclaration(node);
34495- tracing.pop();
34495+ tracing? .pop();
3449634496 }
3449734497
3449834498 function checkBindingElement(node: BindingElement) {
@@ -37570,7 +37570,7 @@ namespace ts {
3757037570 }
3757137571
3757237572 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 });
3757437574 const saveCurrentNode = currentNode;
3757537575 currentNode = node;
3757637576 instantiationCount = 0;
@@ -37606,16 +37606,16 @@ namespace ts {
3760637606 break;
3760737607 }
3760837608 currentNode = saveCurrentNode;
37609- tracing.pop();
37609+ tracing? .pop();
3761037610 }
3761137611
3761237612 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);
3761437614 performance.mark("beforeCheck");
3761537615 checkSourceFileWorker(node);
3761637616 performance.mark("afterCheck");
3761737617 performance.measure("Check", "beforeCheck", "afterCheck");
37618- tracing.pop();
37618+ tracing? .pop();
3761937619 }
3762037620
3762137621 function unusedIsError(kind: UnusedKind, isAmbient: boolean): boolean {
0 commit comments