mirror of
https://github.com/golang/go
synced 2024-11-11 23:20:24 -07:00
cmd/compile: fix lazy loading in reader2
Calling reader2.obj fully loads the referenced object, which is necessary in general; but for reading the package index, we just need to setup the name->index mapping. This CL adds this, so that lazy loading works as intended. Change-Id: Ie51d59e2247d99b46f9dc69fba7ce89e2584b7c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/348011 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
81188661f1
commit
e581ec07ee
@ -43,7 +43,12 @@ func readPackage2(check *types2.Checker, imports map[string]*types2.Package, inp
|
||||
r.bool() // has init
|
||||
|
||||
for i, n := 0, r.len(); i < n; i++ {
|
||||
r.obj()
|
||||
// As if r.obj(), but avoiding the Scope.Lookup call,
|
||||
// to avoid eager loading of imports.
|
||||
r.sync(syncObject)
|
||||
assert(!r.bool())
|
||||
r.p.objIdx(r.reloc(relocObj))
|
||||
assert(r.len() == 0)
|
||||
}
|
||||
|
||||
r.sync(syncEOF)
|
||||
|
Loading…
Reference in New Issue
Block a user