@@ -175,9 +175,7 @@ func Index(files []*parsego.File, pkg *types.Package, info *types.Info, asmFiles
175175// of (package path, object path).
176176func Lookup (mp * metadata.Package , data []byte , targets map [metadata.PackagePath ]map [objectpath.Path ]struct {}) (locs []protocol.Location ) {
177177 var (
178- packages []* gobPackage
179- goFilesLen = len (mp .CompiledGoFiles )
180- goAsmFilesLen = len (mp .AsmFiles )
178+ packages []* gobPackage
181179 )
182180 packageCodec .Decode (data , & packages )
183181 for _ , gp := range packages {
@@ -186,12 +184,10 @@ func Lookup(mp *metadata.Package, data []byte, targets map[metadata.PackagePath]
186184 if _ , ok := objectSet [gobObj .Path ]; ok {
187185 for _ , ref := range gobObj .Refs {
188186 var uri protocol.DocumentURI
189- if ref .FileIndex < goFilesLen {
187+ if asmIndex := ref .FileIndex - len ( mp . CompiledGoFiles ); asmIndex < 0 {
190188 uri = mp .CompiledGoFiles [ref .FileIndex ]
191- } else if ref .FileIndex < goFilesLen + goAsmFilesLen {
192- uri = mp .AsmFiles [ref .FileIndex ]
193189 } else {
194- continue // out of bounds
190+ uri = mp . AsmFiles [ asmIndex ]
195191 }
196192 locs = append (locs , protocol.Location {
197193 URI : uri ,
@@ -234,6 +230,6 @@ type gobObject struct {
234230}
235231
236232type gobRef struct {
237- FileIndex int // index of enclosing file within P's CompiledGoFiles
233+ FileIndex int // index of enclosing file within P's CompiledGoFiles + AsmFiles
238234 Range protocol.Range // source range of reference
239235}
0 commit comments