diff options
author | Robert Griesemer <gri@golang.org> | 2010-02-24 16:17:11 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2010-02-24 16:17:11 -0800 |
commit | 7d9ed9a739596cdbc82850e2a2ac6fa3a74db65d (patch) | |
tree | 914f933c798081034a78b3a18fdbe51cea69b6dc /src/pkg/go/doc/doc.go | |
parent | d5b3aa68ecdd12c7a45b2d640ea453937a234873 (diff) | |
download | golang-7d9ed9a739596cdbc82850e2a2ac6fa3a74db65d.tar.gz |
go/ast: streamline representation of field lists
- always include position information about opening/closing parens/braces
- replace uses of []*ast.Field with *ast.FieldList
Fixes issue 473.
R=rsc
CC=golang-dev
http://codereview.appspot.com/223043
Diffstat (limited to 'src/pkg/go/doc/doc.go')
-rw-r--r-- | src/pkg/go/doc/doc.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/go/doc/doc.go b/src/pkg/go/doc/doc.go index ba7cf45c3..1bf496933 100644 --- a/src/pkg/go/doc/doc.go +++ b/src/pkg/go/doc/doc.go @@ -153,7 +153,7 @@ func (doc *docReader) addFunc(fun *ast.FuncDecl) { // determine if it should be associated with a type if fun.Recv != nil { // method - typ := doc.lookupTypeDoc(baseTypeName(fun.Recv.Type)) + typ := doc.lookupTypeDoc(baseTypeName(fun.Recv.List[0].Type)) if typ != nil { // exported receiver type typ.methods[name] = fun @@ -168,8 +168,8 @@ func (doc *docReader) addFunc(fun *ast.FuncDecl) { // perhaps a factory function // determine result type, if any - if len(fun.Type.Results) >= 1 { - res := fun.Type.Results[0] + if fun.Type.Results.NumFields() >= 1 { + res := fun.Type.Results.List[0] if len(res.Names) <= 1 { // exactly one (named or anonymous) result associated // with the first type in result signature (there may @@ -398,7 +398,7 @@ func makeFuncDocs(m map[string]*ast.FuncDecl) []*FuncDoc { doc.Doc = CommentText(f.Doc) f.Doc = nil // doc consumed - remove from ast.FuncDecl node if f.Recv != nil { - doc.Recv = f.Recv.Type + doc.Recv = f.Recv.List[0].Type } doc.Name = f.Name.Name() doc.Decl = f |