Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go_indexer): link return vars #5821

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions kythe/go/indexer/markedsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (pi *PackageInfo) MarkedSource(obj types.Object) *cpb.MarkedSource {
Child: []*cpb.MarkedSource{{
Kind: cpb.MarkedSource_IDENTIFIER,
PreText: v.Name(),
Link: []*cpb.Link{{Definition: []string{kytheuri.ToString(pi.ObjectVName(v))}}},
}, {
Kind: cpb.MarkedSource_TYPE,
PreText: typeName(v.Type()),
Expand Down
16 changes: 16 additions & 0 deletions kythe/go/indexer/testdata/code/funcdecl.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,19 @@ func Positive(x int) bool {
// - TCResult child.0 TCReturn
// - TCReturn.pre_text "bool"
func True() bool { return true }

// - @N defines/binding N
// - N code NCode
// - NCode child.3 Ret
// - Ret.pre_text " ("
// - Ret.post_child_text ", "
// - Ret.post_text ")"
// - Ret child.0 ErrRet
// - ErrRet.post_child_text " "
// - ErrRet child.0 ErrVar
// - ErrVar.pre_text "err"
// - ErrVar link Err
// - ErrRet child.1 ErrType
// - ErrType.pre_text "error"
// - @#0err defines/binding Err
func N() (err error) { return nil }