From 2a03786e02ffb7c728423f6471076e7769f9efef Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 27 Aug 2009 11:21:52 -0700 Subject: 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 --- usr/austin/eval/compiler.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'usr/austin/eval/compiler.go') 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 -- cgit v1.2.3