mirror of
https://github.com/golang/go
synced 2024-11-17 17:54:48 -07:00
cmd/compile/internal/types2: record error code in Error struct
go/types already does this, if slightly differently. Change-Id: I9cf5f493714d865deec5ad23e2ee9b5c5d3f2f0c Reviewed-on: https://go-review.googlesource.com/c/go/+/475197 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
49588d0c55
commit
ad3ea0134f
@ -27,6 +27,7 @@ import (
|
||||
"cmd/compile/internal/syntax"
|
||||
"fmt"
|
||||
"go/constant"
|
||||
. "internal/types/errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -39,6 +40,7 @@ type Error struct {
|
||||
Msg string // default error message, user-friendly
|
||||
Full string // full error message, for debugging (may contain internal details)
|
||||
Soft bool // if set, error is "soft"
|
||||
Code Code // error code
|
||||
}
|
||||
|
||||
// Error returns an error string formatted as follows:
|
||||
|
@ -250,7 +250,7 @@ func (check *Checker) err(at poser, code Code, msg string, soft bool) {
|
||||
pos = check.errpos
|
||||
}
|
||||
|
||||
err := Error{pos, stripAnnotations(msg), msg, soft}
|
||||
err := Error{pos, stripAnnotations(msg), msg, soft, code}
|
||||
if check.firstErr == nil {
|
||||
check.firstErr = err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user