diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 267f4b32b5f..73e8bef6428 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2408,6 +2408,7 @@ namespace ts { return; } setParent(node, parent); + if (tracing) (node as TracingNode).tracingPath = file.path; const saveInStrictMode = inStrictMode; // Even though in the AST the jsdoc @typedef node belongs to the current node, diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d379885a4cb..9347310350d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -34028,7 +34028,7 @@ namespace ts { } function checkExpression(node: Expression | QualifiedName, checkMode?: CheckMode, forceTuple?: boolean): Type { - tracing?.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end }); + tracing?.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: (node as TracingNode).tracingPath }); const saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; @@ -37104,7 +37104,7 @@ namespace ts { } function checkVariableDeclaration(node: VariableDeclaration) { - tracing?.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end }); + tracing?.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: (node as TracingNode).tracingPath }); checkGrammarVariableDeclaration(node); checkVariableLikeDeclaration(node); tracing?.pop(); @@ -40541,7 +40541,7 @@ namespace ts { } function checkDeferredNode(node: Node) { - tracing?.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end }); + tracing?.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: (node as TracingNode).tracingPath }); const saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index 31c1c8910cf..4757ac72e1b 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -341,4 +341,8 @@ namespace ts { // eslint-disable-line one-namespace-per-file // define after tracingEnabled is initialized export const startTracing = tracingEnabled.startTracing; export const dumpTracingLegend = tracingEnabled.dumpLegend; + + export interface TracingNode { + tracingPath?: Path; + } }