Move error reporting to its own package.

This commit is contained in:
Mariano Uvalle 2023-05-06 23:04:27 +00:00
parent d7c5a19f85
commit 0641c47109

View file

@ -1,8 +1,10 @@
package runner package errors
import "fmt" import "fmt"
func emitError(line int, message string) { var hadError = false
func EmitError(line int, message string) {
report(line, "", message) report(line, "", message)
} }
@ -13,6 +15,9 @@ func report(line int, where, message string) {
where, where,
message, message,
) )
// TODO: The book sets `hadError` as true here, need to figure out where hadError = true
// that's used. }
func HadError() bool {
return hadError
} }