In the few obvious candidates that I found after a bit of grepping.
Change-Id: I36af79c46d29e4422bce1f43bbbac9db7de2001a
Reviewed-on: https://go-review.googlesource.com/c/go/+/650656
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
if w.isDeprecated(m) {
w.emitf("%s //deprecated", m.Name())
}
- w.emitf("%s%s", m.Name(), w.signatureString(m.Type().(*types.Signature)))
+ w.emitf("%s%s", m.Name(), w.signatureString(m.Signature()))
}
if !complete {
}
func (w *Walker) emitFunc(f *types.Func) {
- sig := f.Type().(*types.Signature)
+ sig := f.Signature()
if sig.Recv() != nil {
panic("method considered a regular function: " + f.String())
}
}
func hasIota(s ast.Spec) bool {
- has := false
- ast.Inspect(s, func(n ast.Node) bool {
+ for n := range ast.Preorder(s) {
// Check that this is the special built-in "iota" identifier, not
// a user-defined shadow.
if id, ok := n.(*ast.Ident); ok && id.Name == "iota" && id.Obj == nil {
- has = true
- return false
+ return true
}
- return true
- })
- return has
+ }
+ return false
}
// findImportGroupStarts finds the start positions of each sequence of import
// check explicitly declared methods
for i := 0; i < iface.NumExplicitMethods(); i++ {
m := iface.ExplicitMethod(i)
- recv := m.Type().(*types.Signature).Recv()
+ recv := m.Signature().Recv()
if recv == nil {
t.Errorf("%s: missing receiver type", m)
continue
methods := make([]*types.Func, iface.NumExplicitMethods())
for i := range methods {
fn := iface.ExplicitMethod(i)
- sig := fn.Type().(*types.Signature)
+ sig := fn.Signature()
recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named)
methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignature(recv, sig.Params(), sig.Results(), sig.Variadic()))
// check explicitly declared methods
for i := 0; i < iface.NumExplicitMethods(); i++ {
m := iface.ExplicitMethod(i)
- recv := m.Type().(*types.Signature).Recv()
+ recv := m.Signature().Recv()
if recv == nil {
t.Errorf("%s: missing receiver type", m)
continue