diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-01-22 14:29:38 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-01-22 14:29:38 -0800 |
| commit | 93d92d51ddccbbc689f4b9adeded4f310ba0c363 (patch) | |
| tree | 867510c12ec5a34bb85c6a2a8971a0d4bc234ea8 /src/cmd/api/goapi.go | |
| parent | b9f0a6bf6833f2f70caf6451133919a2807d0943 (diff) | |
| download | go-git-93d92d51ddccbbc689f4b9adeded4f310ba0c363.tar.gz | |
cmd/api: fix type scrubbing
It wasn't removing names from func parameters for func types,
and it was handling "a, b string" as "string", not "string, string".
Fixes #4688
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7181051
Diffstat (limited to 'src/cmd/api/goapi.go')
| -rw-r--r-- | src/cmd/api/goapi.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 6d39a463f6..1ee852ea79 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -879,7 +879,7 @@ func (w *Walker) walkTypeSpec(ts *ast.TypeSpec) { case *ast.InterfaceType: w.walkInterfaceType(name, t) default: - w.emitFeature(fmt.Sprintf("type %s %s", name, w.nodeString(ts.Type))) + w.emitFeature(fmt.Sprintf("type %s %s", name, w.nodeString(w.namelessType(ts.Type)))) } } @@ -1120,7 +1120,13 @@ func (w *Walker) namelessFieldList(fl *ast.FieldList) *ast.FieldList { fl2 := &ast.FieldList{} if fl != nil { for _, f := range fl.List { - fl2.List = append(fl2.List, w.namelessField(f)) + repeats := 1 + if len(f.Names) > 1 { + repeats = len(f.Names) + } + for i := 0; i < repeats; i++ { + fl2.List = append(fl2.List, w.namelessField(f)) + } } } return fl2 |
