compiler: add location information to the IR checker

This commit is contained in:
Ayke van Laethem
2019-12-07 22:10:21 +01:00
committed by Ron Evans
parent dffb9fbfa7
commit 5510dec846
5 changed files with 85 additions and 42 deletions
+14
View File
@@ -12,6 +12,20 @@ func (e *MultiError) Error() string {
return e.Errs[0].Error()
}
// newMultiError returns a *MultiError if there is more than one error, or
// returns that error directly when there is only one. Passing an empty slice
// will lead to a panic.
func newMultiError(errs []error) error {
switch len(errs) {
case 0:
panic("attempted to create empty MultiError")
case 1:
return errs[0]
default:
return &MultiError{errs}
}
}
// commandError is an error type to wrap os/exec.Command errors. This provides
// some more information regarding what went wrong while running a command.
type commandError struct {