]> Cypherpunks.ru repositories - gostls13.git/commitdiff
go/ast: remove FuncDecl.IsMethod for Go 1.17
authorRob Findley <rfindley@google.com>
Fri, 28 May 2021 02:27:55 +0000 (22:27 -0400)
committerRobert Findley <rfindley@google.com>
Fri, 28 May 2021 03:34:02 +0000 (03:34 +0000)
The IsMethod method was added to FuncDecl in the process of working on
support for type parameters, but is now only used in one place. It also
didn't go through the proposal process. Remove it for 1.17.

Also clean up a doc comment that mentioned type parameters.

Fixes #46297

Change-Id: I432bdd626324f613baf059540b7c5436985b2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/323369
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/ast/ast.go
src/go/types/resolver.go

index c87529ec77dda9399b803cfe632b7b9fc2f90904..337c87fd797351c344bf3e4b2ea01c20b3235c2e 100644 (file)
@@ -259,7 +259,7 @@ func (f *FieldList) End() token.Pos {
        return token.NoPos
 }
 
-// NumFields returns the number of (type) parameters or struct fields represented by a FieldList.
+// NumFields returns the number of parameters or struct fields represented by a FieldList.
 func (f *FieldList) NumFields() int {
        n := 0
        if f != nil {
@@ -973,10 +973,6 @@ type (
        }
 )
 
-func (f *FuncDecl) IsMethod() bool {
-       return f.Recv.NumFields() != 0
-}
-
 // Pos and End implementations for declaration nodes.
 
 func (d *BadDecl) Pos() token.Pos  { return d.From }
index f67fc65cd18d69c945df5e781f9c32785e265088..114647a2fffecb937bd785c3d85e3467626499a4 100644 (file)
@@ -383,7 +383,7 @@ func (check *Checker) collectObjects() {
                                info := &declInfo{file: fileScope, fdecl: d.decl}
                                name := d.decl.Name.Name
                                obj := NewFunc(d.decl.Name.Pos(), pkg, name, nil)
-                               if !d.decl.IsMethod() {
+                               if d.decl.Recv.NumFields() == 0 {
                                        // regular function
                                        if d.decl.Recv != nil {
                                                check.error(d.decl.Recv, _BadRecv, "method is missing receiver")