diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
commit | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch) | |
tree | 32944e18b23f7fe4a0818a694aa2a6dfb1835463 /src/cmd/gc/lex.c | |
parent | e836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff) | |
download | golang-upstream/59.tar.gz |
Imported Upstream version 59upstream/59
Diffstat (limited to 'src/cmd/gc/lex.c')
-rw-r--r-- | src/cmd/gc/lex.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/cmd/gc/lex.c b/src/cmd/gc/lex.c index 88acb60af..5c642375a 100644 --- a/src/cmd/gc/lex.c +++ b/src/cmd/gc/lex.c @@ -97,7 +97,7 @@ fault(int s) // in the program, don't bother complaining // about the seg fault too; let the user clean up // the code and try again. - if(nerrors > 0) + if(nsavederrors + nerrors > 0) errorexit(); fatal("fault"); } @@ -256,7 +256,10 @@ main(int argc, char *argv[]) for(l=xtop; l; l=l->next) if(l->n->op == ODCLFUNC) { curfn = l->n; + saveerrors(); typechecklist(l->n->nbody, Etop); + if(nerrors != 0) + l->n->nbody = nil; // type errors; do not compile } curfn = nil; @@ -264,7 +267,7 @@ main(int argc, char *argv[]) if(l->n->op == ODCLFUNC) funccompile(l->n, 0); - if(nerrors == 0) + if(nsavederrors+nerrors == 0) fninit(xtop); while(closures) { @@ -278,12 +281,12 @@ main(int argc, char *argv[]) if(l->n->op == ONAME) typecheck(&l->n, Erv); - if(nerrors) + if(nerrors+nsavederrors) errorexit(); dumpobj(); - if(nerrors) + if(nerrors+nsavederrors) errorexit(); flusherrors(); @@ -291,6 +294,13 @@ main(int argc, char *argv[]) return 0; } +void +saveerrors(void) +{ + nsavederrors += nerrors; + nerrors = 0; +} + static int arsize(Biobuf *b, char *name) { |