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)
|
name := x.intern(id.Name)
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case TypeDecl, FuncDecl:
|
case TypeDecl, FuncDecl, ConstDecl, VarDecl:
|
||||||
x.curPkgExports[name] = kind
|
x.curPkgExports[name] = kind
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ package foo
|
||||||
|
|
||||||
import "bar"
|
import "bar"
|
||||||
|
|
||||||
|
const Pi = 3.1415
|
||||||
|
|
||||||
|
var Foos []Foo
|
||||||
|
|
||||||
// Foo is stuff.
|
// Foo is stuff.
|
||||||
type Foo struct{}
|
type Foo struct{}
|
||||||
|
|
||||||
|
|
@ -87,7 +91,7 @@ func TestIndexWriteRead(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testIndex(t *testing.T, ix *Index) {
|
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) {
|
if !reflect.DeepEqual(ix.Stats(), wantStats) {
|
||||||
t.Errorf("Stats = %#v; want %#v", ix.Stats(), wantStats)
|
t.Errorf("Stats = %#v; want %#v", ix.Stats(), wantStats)
|
||||||
}
|
}
|
||||||
|
|
@ -116,8 +120,10 @@ func testIndex(t *testing.T, ix *Index) {
|
||||||
|
|
||||||
if got, want := ix.Exports(), map[string]map[string]SpotKind{
|
if got, want := ix.Exports(), map[string]map[string]SpotKind{
|
||||||
"foo": map[string]SpotKind{
|
"foo": map[string]SpotKind{
|
||||||
"Foo": TypeDecl,
|
"Pi": ConstDecl,
|
||||||
"New": FuncDecl,
|
"Foos": VarDecl,
|
||||||
|
"Foo": TypeDecl,
|
||||||
|
"New": FuncDecl,
|
||||||
},
|
},
|
||||||
"other/bar": map[string]SpotKind{
|
"other/bar": map[string]SpotKind{
|
||||||
"X": FuncDecl,
|
"X": FuncDecl,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue