Skip to content

Commit

Permalink
fix(go_indexer): use LOOKUP_BY_PARAM for method recv (#5781)
Browse files Browse the repository at this point in the history
  • Loading branch information
schroederc committed Aug 9, 2023
1 parent a47fcd4 commit 69fb2ae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
8 changes: 1 addition & 7 deletions kythe/go/indexer/markedsource.go
Expand Up @@ -93,15 +93,9 @@ func (pi *PackageInfo) MarkedSource(obj types.Object) *cpb.MarkedSource {
if recv := sig.Recv(); recv != nil {
// Parenthesized receiver type, e.g. (R).
fn.Child = append(fn.Child, &cpb.MarkedSource{
// TODO(schroederc): use LOOKUP_BY_PARAM
Kind: cpb.MarkedSource_PARAMETER,
Kind: cpb.MarkedSource_LOOKUP_BY_PARAM,
PreText: "(",
PostText: ") ",
Child: []*cpb.MarkedSource{{
Kind: cpb.MarkedSource_TYPE,
PreText: typeName(recv.Type()) + typeArgs(recv.Type()),
Link: []*cpb.Link{{Definition: []string{kytheuri.ToString(pi.ObjectVName(recv))}}},
}},
})
firstParam = 1
}
Expand Down
6 changes: 1 addition & 5 deletions kythe/go/indexer/testdata/code/interface.go
Expand Up @@ -25,20 +25,16 @@ type Thinger interface {
//- MFunc.pre_text "func"
//- MFunc.post_text " "
//-
//- MRecv.kind "PARAMETER"
//- MRecv.kind "LOOKUP_BY_PARAM"
//- MRecv.pre_text "("
//- MRecv.post_text ") "
//- MRecv child.0 MRType
//-
//- MName child.0 MContext
//- MName child.1 MIdent
//-
//- MParams.kind "PARAMETER"
//- MParams.pre_text "()"
//-
//- MRType.kind "TYPE"
//- MRType.pre_text "Thinger"
//-
//- MContext.kind "CONTEXT"
//- MContext.post_child_text "."
//- MContext child.0 MPkg
Expand Down
12 changes: 2 additions & 10 deletions kythe/go/indexer/testdata/code/methdecl.go
Expand Up @@ -16,10 +16,9 @@ type w struct{}
// - LTFunc.pre_text "func"
// - LTFunc.post_text " "
// -
// - LTRecv.kind "PARAMETER"
// - LTRecv.kind "LOOKUP_BY_PARAM"
// - LTRecv.pre_text "("
// - LTRecv.post_text ") "
// - LTRecv child.0 LTRType
// -
// - LTName child.0 LTContext
// - LTName child.1 LTIdent
Expand All @@ -35,9 +34,6 @@ type w struct{}
// - LTResult child.0 LTReturn
// - LTReturn.pre_text "bool"
// -
// - LTRType.kind "TYPE"
// - LTRType.pre_text "*w"
// -
// - LTContext.kind "CONTEXT"
// - LTContext.post_child_text "."
// - LTContext child.0 LTPkg
Expand Down Expand Up @@ -86,10 +82,9 @@ type API struct{}
// - RFFunc.pre_text "func"
// - RFFunc.post_text " "
// -
// - RFRecv.kind "PARAMETER"
// - RFRecv.kind "LOOKUP_BY_PARAM"
// - RFRecv.pre_text "("
// - RFRecv.post_text ") "
// - RFRecv child.0 RFRType
// -
// - RFName child.0 RFContext
// - RFName child.1 RFIdent
Expand All @@ -105,9 +100,6 @@ type API struct{}
// - RFResult child.0 RFReturn
// - RFReturn.pre_text "error"
// -
// - RFRType.kind "TYPE"
// - RFRType.pre_text "decorCommand"
// -
// - RFContext.kind "CONTEXT"
// - RFContext.post_child_text "."
// - RFContext child.0 RFPkg
Expand Down
5 changes: 1 addition & 4 deletions kythe/go/indexer/testdata/generics/genericmethod.go
Expand Up @@ -43,10 +43,7 @@ func (c *Container[T]) Get() T {
//- Get code GetCode
//- GetCode.kind "BOX"
//- GetCode child.1 RecvCode
//- RecvCode.kind "PARAMETER"
//- RecvCode child.0 RecvType
//- RecvType.kind "TYPE"
//- RecvType.pre_text "*Container[T]"
//- RecvCode.kind "LOOKUP_BY_PARAM"

// And can technically be renamed
// - @Put defines/binding Put
Expand Down

0 comments on commit 69fb2ae

Please sign in to comment.