mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: pass type checker error codes in the compiler
Pass type checker error codes to base.ErrorfAt function calls in the compiler (but don't do anything yet with the code). Also, provide error codes to base.ErrorfAt calls in the compiler as needed. This opens the door towards reporting the error code and/or providing a link/reference to more detailed explanations (see internal/types/errors/codes.go). Change-Id: I0ff9368d8163499ffdac6adfe8331fdc4a19b4b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/475198 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
3790ceca97
commit
2cbab4e98c
20 changed files with 74 additions and 65 deletions
|
|
@ -560,7 +560,7 @@ func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
|
|||
fn := arg.(*ir.ConvExpr).X.(*ir.Name)
|
||||
abi := fn.Func.ABI
|
||||
if abi != wantABI {
|
||||
base.ErrorfAt(n.Pos(), "internal/abi.%s expects an %v function, %s is defined as %v", name, wantABI, fn.Sym().Name, abi)
|
||||
base.ErrorfAt(n.Pos(), 0, "internal/abi.%s expects an %v function, %s is defined as %v", name, wantABI, fn.Sym().Name, abi)
|
||||
}
|
||||
var e ir.Node = ir.NewLinksymExpr(n.Pos(), fn.Sym().LinksymABI(abi), types.Types[types.TUINTPTR])
|
||||
e = ir.NewAddrExpr(n.Pos(), e)
|
||||
|
|
@ -570,7 +570,7 @@ func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
|
|||
// fn is not a defined function. It must be ABIInternal.
|
||||
// Read the address from func value, i.e. *(*uintptr)(idata(fn)).
|
||||
if wantABI != obj.ABIInternal {
|
||||
base.ErrorfAt(n.Pos(), "internal/abi.%s does not accept func expression, which is ABIInternal", name)
|
||||
base.ErrorfAt(n.Pos(), 0, "internal/abi.%s does not accept func expression, which is ABIInternal", name)
|
||||
}
|
||||
arg = walkExpr(arg, init)
|
||||
var e ir.Node = ir.NewUnaryExpr(n.Pos(), ir.OIDATA, arg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue