From 258fc75505f170bc94c73d64e9b4a0d986108e96 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 28 Feb 2022 21:21:40 -0800 Subject: [PATCH] cmd/compile/internal/importer: lazier unified IR importing No need to eagerly read the object dictionary or setup the object reader outside of the lazy resolve function. Change-Id: Ic4245b0c09f3beaff97860d7f2dfb5b2b5778cc9 Reviewed-on: https://go-review.googlesource.com/c/go/+/388615 Run-TryBot: Matthew Dempsky TryBot-Result: Gopher Robot Trust: Matthew Dempsky Reviewed-by: Cuong Manh Le --- src/cmd/compile/internal/importer/ureader.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/compile/internal/importer/ureader.go b/src/cmd/compile/internal/importer/ureader.go index 1b61f37dc8..a22cd2bb53 100644 --- a/src/cmd/compile/internal/importer/ureader.go +++ b/src/cmd/compile/internal/importer/ureader.go @@ -375,12 +375,12 @@ func (pr *pkgReader) objIdx(idx int) (*types2.Package, string) { return objPkg, objName } - dict := pr.objDictIdx(idx) - - r := pr.newReader(pkgbits.RelocObj, idx, pkgbits.SyncObject1) - r.dict = dict - objPkg.Scope().InsertLazy(objName, func() types2.Object { + dict := pr.objDictIdx(idx) + + r := pr.newReader(pkgbits.RelocObj, idx, pkgbits.SyncObject1) + r.dict = dict + switch tag { default: panic("weird")