diff options
author | Austin Clements <aclements@csail.mit.edu> | 2009-08-27 11:21:52 -0700 |
---|---|---|
committer | Austin Clements <aclements@csail.mit.edu> | 2009-08-27 11:21:52 -0700 |
commit | 2a03786e02ffb7c728423f6471076e7769f9efef (patch) | |
tree | 684f202d8c590d14b188507a7ee1e9a08a930127 /usr/austin/eval/compiler.go | |
parent | e0347fcfd827558d7b7a15995d61a17cb080b11d (diff) | |
download | golang-2a03786e02ffb7c728423f6471076e7769f9efef.tar.gz |
Make the statement compiler not use the AST visitor.
In the process, I made error handling in the statement
compiler much saner. Instead of separately tracking various
error flags with weird relations, I just track if any error
messages have been produced.
R=rsc
APPROVED=rsc
DELTA=308 (98 added, 135 deleted, 75 changed)
OCL=33870
CL=33961
Diffstat (limited to 'usr/austin/eval/compiler.go')
-rw-r--r-- | usr/austin/eval/compiler.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/austin/eval/compiler.go b/usr/austin/eval/compiler.go index f5c125a8e..676bff31e 100644 --- a/usr/austin/eval/compiler.go +++ b/usr/austin/eval/compiler.go @@ -24,13 +24,21 @@ type positioned interface { // case it should be package compiler. type compiler struct { errors scanner.ErrorHandler; + numErrors int; + silentErrors int; } func (a *compiler) diagAt(pos positioned, format string, args ...) { a.errors.Error(pos.Pos(), fmt.Sprintf(format, args)); + a.numErrors++; +} + +func (a *compiler) numError() int { + return a.numErrors + a.silentErrors; } +// TODO(austin) These can all go in stmt.go now type label struct { name string; desc string; @@ -61,7 +69,6 @@ type funcCompiler struct { *codeBuf; flow *flowBuf; labels map[string] *label; - err bool; } // A blockCompiler captures information used throughout the compilation |