@@ -175,9 +175,7 @@ func Index(files []*parsego.File, pkg *types.Package, info *types.Info, asmFiles
175
175
// of (package path, object path).
176
176
func Lookup (mp * metadata.Package , data []byte , targets map [metadata.PackagePath ]map [objectpath.Path ]struct {}) (locs []protocol.Location ) {
177
177
var (
178
- packages []* gobPackage
179
- goFilesLen = len (mp .CompiledGoFiles )
180
- goAsmFilesLen = len (mp .AsmFiles )
178
+ packages []* gobPackage
181
179
)
182
180
packageCodec .Decode (data , & packages )
183
181
for _ , gp := range packages {
@@ -186,12 +184,10 @@ func Lookup(mp *metadata.Package, data []byte, targets map[metadata.PackagePath]
186
184
if _ , ok := objectSet [gobObj .Path ]; ok {
187
185
for _ , ref := range gobObj .Refs {
188
186
var uri protocol.DocumentURI
189
- if ref .FileIndex < goFilesLen {
187
+ if asmIndex := ref .FileIndex - len ( mp . CompiledGoFiles ); asmIndex < 0 {
190
188
uri = mp .CompiledGoFiles [ref .FileIndex ]
191
- } else if ref .FileIndex < goFilesLen + goAsmFilesLen {
192
- uri = mp .AsmFiles [ref .FileIndex ]
193
189
} else {
194
- continue // out of bounds
190
+ uri = mp . AsmFiles [ asmIndex ]
195
191
}
196
192
locs = append (locs , protocol.Location {
197
193
URI : uri ,
@@ -234,6 +230,6 @@ type gobObject struct {
234
230
}
235
231
236
232
type 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
238
234
Range protocol.Range // source range of reference
239
235
}
0 commit comments