Skip to content

Commit

Permalink
Issue #162: Cope with empty programs in mujs-pp.
Browse files Browse the repository at this point in the history
  • Loading branch information
ccxvii committed May 17, 2022
1 parent 910acc8 commit 799b62b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions jsdump.c
Expand Up @@ -682,11 +682,13 @@ static void pstmlist(int d, js_Ast *list)
void jsP_dumpsyntax(js_State *J, js_Ast *prog, int dominify)
{
minify = dominify;
if (prog->type == AST_LIST)
pstmlist(-1, prog);
else {
pstm(0, prog);
nl();
if (prog) {
if (prog->type == AST_LIST)
pstmlist(-1, prog);
else {
pstm(0, prog);
nl();
}
}
if (minify > 1)
putchar('\n');
Expand Down Expand Up @@ -768,11 +770,13 @@ static void sblock(int d, js_Ast *list)
void jsP_dumplist(js_State *J, js_Ast *prog)
{
minify = 0;
if (prog->type == AST_LIST)
sblock(0, prog);
else
snode(0, prog);
nl();
if (prog) {
if (prog->type == AST_LIST)
sblock(0, prog);
else
snode(0, prog);
nl();
}
}

/* Compiled code */
Expand Down

0 comments on commit 799b62b

Please sign in to comment.