Skip to content

Commit ad7b1c2

Browse files
committed
Print out type and symbol count deltas for each statement
1 parent 2458c8a commit ad7b1c2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/compiler/checker.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34013,7 +34013,20 @@ namespace ts {
3401334013
const saveCurrentNode = currentNode;
3401434014
currentNode = node;
3401534015
instantiationCount = 0;
34016+
34017+
const oldTypeCount = typeCount;
34018+
const oldSymbolCount = symbolCount;
34019+
3401634020
checkSourceElementWorker(node);
34021+
34022+
if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement) {
34023+
const sourceFile = getSourceFileOfNode(node);
34024+
const startLC = getLineAndCharacterOfPosition(sourceFile, skipTrivia(sourceFile.text, node.pos));
34025+
const endLC = getLineAndCharacterOfPosition(sourceFile, node.end);
34026+
34027+
sys.write(`"${sourceFile.path}",${startLC.line + 1},${startLC.character + 1},${endLC.line + 1},${endLC.character + 1},${typeCount - oldTypeCount},${symbolCount - oldSymbolCount}` + sys.newLine);
34028+
}
34029+
3401734030
currentNode = saveCurrentNode;
3401834031
}
3401934032
}
@@ -34035,6 +34048,7 @@ namespace ts {
3403534048
cancellationToken.throwIfCancellationRequested();
3403634049
}
3403734050
}
34051+
3403834052
if (kind >= SyntaxKind.FirstStatement && kind <= SyntaxKind.LastStatement && node.flowNode && !isReachableFlowNode(node.flowNode)) {
3403934053
errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected);
3404034054
}

src/executeCommandLine/executeCommandLine.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ namespace ts {
344344
cb: ExecuteCommandLineCallbacks,
345345
commandLineArgs: readonly string[],
346346
) {
347+
system.write(`"Path","Start Line","Start Character","End Line","End Character","Type Delta","Symbol Delta"` + system.newLine);
348+
347349
if (isBuild(commandLineArgs)) {
348350
const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
349351
if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {

0 commit comments

Comments
 (0)