scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit b415245da5d38ce56bd3831eecc2d679db9fc231
parent ba47ba8ffc19b3f386bbc01989dda5e0dd1d644d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 22 Aug 2012 00:21:36 +0200

Moving tree printing once the full function is parsed

At the function level we can be sure the expresion will not be used again,
so it is the better place (for now) for printing it.

Diffstat:
decl.c | 4+++-
flow.c | 2--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/decl.c b/decl.c @@ -143,7 +143,9 @@ listdcl(register struct ctype *tp) "type defaults to 'int' in declaration of '%s'", yytext); } else if (new->type == FTN && yytoken == '{') { - compound(); + struct node *np = compound(); + prtree(np); + putchar('\n'); return; } } while (accept(',')); diff --git a/flow.c b/flow.c @@ -120,7 +120,5 @@ compound(void) addstmt(np, stmt()); del_ctx(); - prtree(np); - putchar('\n'); return np; }