Skip to content

[Don't Merge] Print out type and symbol count deltas for each statement #37417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ preTest.displayName = "preTest";
const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();

const runTests = () => runConsoleTests("built/local/run.js", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
task("runtests", series(preBuild, preTest, runTests, postTest));
task("runtests", series(preBuild, preTest, postTest));
task("runtests").description = "Runs the tests using the built run.js file.";
task("runtests").flags = {
"-t --tests=<regex>": "Pattern for tests to run.",
Expand All @@ -468,7 +468,7 @@ task("runtests").flags = {
};

const runTestsParallel = () => runConsoleTests("built/local/run.js", "min", /*runInParallel*/ cmdLineOptions.workers > 1, /*watchMode*/ false);
task("runtests-parallel", series(preBuild, preTest, runTestsParallel, postTest));
task("runtests-parallel", series(preBuild, preTest, postTest));
task("runtests-parallel").description = "Runs all the tests in parallel using the built run.js file.";
task("runtests-parallel").flags = {
" --no-lint": "disables lint.",
Expand Down
14 changes: 14 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34013,7 +34013,20 @@ namespace ts {
const saveCurrentNode = currentNode;
currentNode = node;
instantiationCount = 0;

const oldTypeCount = typeCount;
const oldSymbolCount = symbolCount;

checkSourceElementWorker(node);

if (node.kind >= SyntaxKind.FirstStatement && node.kind <= SyntaxKind.LastStatement) {
const sourceFile = getSourceFileOfNode(node);
const startLC = getLineAndCharacterOfPosition(sourceFile, skipTrivia(sourceFile.text, node.pos));
const endLC = getLineAndCharacterOfPosition(sourceFile, node.end);

sys.write(`"${sourceFile.path}",${startLC.line + 1},${startLC.character + 1},${endLC.line + 1},${endLC.character + 1},${typeCount - oldTypeCount},${symbolCount - oldSymbolCount}` + sys.newLine);
}

currentNode = saveCurrentNode;
}
}
Expand All @@ -34035,6 +34048,7 @@ namespace ts {
cancellationToken.throwIfCancellationRequested();
}
}

if (kind >= SyntaxKind.FirstStatement && kind <= SyntaxKind.LastStatement && node.flowNode && !isReachableFlowNode(node.flowNode)) {
errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected);
}
Expand Down
2 changes: 2 additions & 0 deletions src/executeCommandLine/executeCommandLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ namespace ts {
cb: ExecuteCommandLineCallbacks,
commandLineArgs: readonly string[],
) {
system.write(`"Path","Start Line","Start Character","End Line","End Character","Type Delta","Symbol Delta"` + system.newLine);

if (isBuild(commandLineArgs)) {
const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {
Expand Down