godoc: Index const and vars in godoc.
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/26990043
This commit is contained in:
parent
9c112540f6
commit
ae3dd78063
|
|
@ -430,7 +430,7 @@ func (x *Indexer) visitIdent(kind SpotKind, id *ast.Ident) {
|
|||
name := x.intern(id.Name)
|
||||
|
||||
switch kind {
|
||||
case TypeDecl, FuncDecl:
|
||||
case TypeDecl, FuncDecl, ConstDecl, VarDecl:
|
||||
x.curPkgExports[name] = kind
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ package foo
|
|||
|
||||
import "bar"
|
||||
|
||||
const Pi = 3.1415
|
||||
|
||||
var Foos []Foo
|
||||
|
||||
// Foo is stuff.
|
||||
type Foo struct{}
|
||||
|
||||
|
|
@ -87,7 +91,7 @@ func TestIndexWriteRead(t *testing.T) {
|
|||
}
|
||||
|
||||
func testIndex(t *testing.T, ix *Index) {
|
||||
wantStats := Statistics{Bytes: 256, Files: 3, Lines: 16, Words: 6, Spots: 9}
|
||||
wantStats := Statistics{Bytes: 291, Files: 3, Lines: 20, Words: 8, Spots: 12}
|
||||
if !reflect.DeepEqual(ix.Stats(), wantStats) {
|
||||
t.Errorf("Stats = %#v; want %#v", ix.Stats(), wantStats)
|
||||
}
|
||||
|
|
@ -116,6 +120,8 @@ func testIndex(t *testing.T, ix *Index) {
|
|||
|
||||
if got, want := ix.Exports(), map[string]map[string]SpotKind{
|
||||
"foo": map[string]SpotKind{
|
||||
"Pi": ConstDecl,
|
||||
"Foos": VarDecl,
|
||||
"Foo": TypeDecl,
|
||||
"New": FuncDecl,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue