mirror of
https://github.com/golang/go
synced 2024-11-18 09:04:49 -07:00
godoc: changes to support aliases
Fixes golang.org/go#17763 Change-Id: I18012dcfd878db916cbb940c3a361a89341b9209 Reviewed-on: https://go-review.googlesource.com/32711 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
d15da3015c
commit
242b5dc780
@ -259,7 +259,7 @@ func testWeb(t *testing.T, withIndex bool) {
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/search?q=notwithstanding",
|
||||
path: "/search?q=ListenAndServe",
|
||||
match: []string{
|
||||
"/src",
|
||||
},
|
||||
|
@ -542,6 +542,10 @@ func (x *Indexer) visitSpec(kind SpotKind, spec ast.Spec) {
|
||||
}
|
||||
}
|
||||
|
||||
case *ast.AliasSpec:
|
||||
x.visitIdent(kind, n.Name)
|
||||
ast.Walk(x, n.Orig)
|
||||
|
||||
case *ast.ValueSpec:
|
||||
for _, n := range n.Names {
|
||||
x.visitIdent(kind, n)
|
||||
|
@ -158,6 +158,8 @@ func identModesFor(node ast.Node) map[*ast.Ident]identMode {
|
||||
if name := n.Name; name != nil {
|
||||
m[name] = identDef
|
||||
}
|
||||
case *ast.AliasSpec:
|
||||
m[n.Name] = identVal
|
||||
case *ast.ValueSpec:
|
||||
for _, n := range n.Names {
|
||||
m[n] = identVal
|
||||
|
@ -427,6 +427,8 @@ func addNames(names map[string]bool, decl ast.Decl) {
|
||||
switch s := spec.(type) {
|
||||
case *ast.TypeSpec:
|
||||
names[s.Name.Name] = true
|
||||
case *ast.AliasSpec:
|
||||
names[s.Name.Name] = true
|
||||
case *ast.ValueSpec:
|
||||
for _, id := range s.Names {
|
||||
names[id.Name] = true
|
||||
|
@ -42,6 +42,10 @@ func findSpec(list []ast.Spec, id *ast.Ident) ast.Spec {
|
||||
if s.Name == id {
|
||||
return s
|
||||
}
|
||||
case *ast.AliasSpec:
|
||||
if s.Name == id {
|
||||
return s
|
||||
}
|
||||
case *ast.ValueSpec:
|
||||
for _, n := range s.Names {
|
||||
if n == id {
|
||||
|
Loading…
Reference in New Issue
Block a user