Commit 50fed64d authored by Keegan Carruthers-Smith's avatar Keegan Carruthers-Smith Committed by Russ Cox

go/doc: don't panic if method is missing recv type

Fixes #17788

Change-Id: I2f8a11321dc8f10bebbc8df90ba00ec65b9ee0fa
Reviewed-on: https://go-review.googlesource.com/32790Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 9a5bddd7
......@@ -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);
......
//
PACKAGE issue17788
IMPORTPATH
testdata/issue17788
FILENAMES
testdata/issue17788.go
//
PACKAGE issue17788
IMPORTPATH
testdata/issue17788
FILENAMES
testdata/issue17788.go
//
PACKAGE issue17788
IMPORTPATH
testdata/issue17788
FILENAMES
testdata/issue17788.go
// 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() {
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment