mirror of
https://github.com/golang/go
synced 2024-11-23 19:50:06 -07:00
go/doc: don't panic if method is missing recv type
Fixes #17788 Change-Id: I2f8a11321dc8f10bebbc8df90ba00ec65b9ee0fa Reviewed-on: https://go-review.googlesource.com/32790 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
9a5bddd7ed
commit
50fed64dd9
@ -362,6 +362,11 @@ func (r *reader) readFunc(fun *ast.FuncDecl) {
|
||||
// associate methods with the receiver type, if any
|
||||
if fun.Recv != nil {
|
||||
// method
|
||||
if len(fun.Recv.List) == 0 {
|
||||
// should not happen (incorrect AST); (See issue 17788)
|
||||
// don't show this method
|
||||
return
|
||||
}
|
||||
recvTypeName, imp := baseTypeName(fun.Recv.List[0].Type)
|
||||
if imp {
|
||||
// should not happen (incorrect AST);
|
||||
|
8
src/go/doc/testdata/issue17788.0.golden
vendored
Normal file
8
src/go/doc/testdata/issue17788.0.golden
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
PACKAGE issue17788
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue17788
|
||||
|
||||
FILENAMES
|
||||
testdata/issue17788.go
|
8
src/go/doc/testdata/issue17788.1.golden
vendored
Normal file
8
src/go/doc/testdata/issue17788.1.golden
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
PACKAGE issue17788
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue17788
|
||||
|
||||
FILENAMES
|
||||
testdata/issue17788.go
|
8
src/go/doc/testdata/issue17788.2.golden
vendored
Normal file
8
src/go/doc/testdata/issue17788.2.golden
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
PACKAGE issue17788
|
||||
|
||||
IMPORTPATH
|
||||
testdata/issue17788
|
||||
|
||||
FILENAMES
|
||||
testdata/issue17788.go
|
8
src/go/doc/testdata/issue17788.go
vendored
Normal file
8
src/go/doc/testdata/issue17788.go
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package issue17788
|
||||
|
||||
func ( /* receiver type */ ) f0() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user