Skip to content

Commit

Permalink
Dont print AST more than we need to
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdz committed Sep 7, 2024
1 parent b9eb285 commit edd9cd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export function preval({ entryPointFile, stdio, verbose, verboseTracing, resolve

firstAfterParse = false;

changed = phase2(program, fdata, resolve, req, prng, {implicitThisIdent: options.implicitThisIdent, prngSeed: rngSeed});
changed = phase2(program, fdata, resolve, req, passes, phase1s, verboseTracing, prng, {implicitThisIdent: options.implicitThisIdent, prngSeed: rngSeed});
options?.onAfterPhase(2, passes, phaseLoop, fdata, changed, options);
if (!changed) {
// Force a normalize pass before moving to phase3. Loop if it changed anything anyways.
Expand Down
7 changes: 5 additions & 2 deletions src/normalize/phase2.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ import { freeFuncs } from '../reduce_static/free_funcs.mjs';
// - should Program always have a block just to eliminate the Program? That's not going to fix function boundaries though but maybe it is more consistent anyways?
// - should loops always explicitly end with a continue statement? does that matter?

export function phase2(program, fdata, resolve, req, prng, options) {
export function phase2(program, fdata, resolve, req, passes, phase1s, verboseTracing, prng, options) {
const ast = fdata.tenkoOutput.ast;
group('\n\n\n##################################\n## phase2 :: ' + fdata.fname + '\n##################################\n\n\n');
if (VERBOSE_TRACING) vlog('\nCurrent state (before phase2)\n--------------\n' + fmat(tmat(ast)) + '\n--------------\n');
// Dont print this again when phase1 is printing almost nothing
if (!(!verboseTracing && (passes > 1 || phase1s > 1))) {
if (VERBOSE_TRACING) vlog('\nCurrent state (before phase2)\n--------------\n' + fmat(tmat(ast)) + '\n--------------\n');
}
vlog('\n\n\n##################################\n## phase2 :: ' + fdata.fname + '\n##################################\n\n\n');

{
Expand Down

0 comments on commit edd9cd5

Please sign in to comment.