Trace key operations by amcasey · Pull Request #40063 · microsoft/TypeScript (original) (raw)
@amcasey I'm having the problem that checkExpression
calls within a checkSourceFile
call often check nodes from completely different files, so just having kind
, pos
and end
is not enough to identify the node in any way.
I am running this patch against 4.1.0-beta to also get the fileName
- but I guess that is not really effective.
Could this be done somehow in a better way - and would a PR for this be welcome?
diff --git a/lib/tsc.js b/lib/tsc.js index c78b8d698ea730be5a363592a25eb5eb9815753b..4333d58e45d2b2a55724ce7f7894c482223fc36c 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -59317,7 +59317,13 @@ var ts; } } function checkExpression(node, checkMode, forceTuple) {
ts.tracing.begin("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
var parent = node.parent;
while (parent && parent.kind !== 300 /*SyntaxKind.SourceFile*/) {
parent = parent.parent
}
var sourceFile = parent;
ts.tracing.begin("check", "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, sourceFile: sourceFile && sourceFile.fileName || "unknown" }); var saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0;