Skip to content

Commit 6d4101e

Browse files
mdempskygopherbot
authored andcommitted
cmd/compile/internal/pkginit: remove dependency on typecheck.Resolve
The use of typecheck.Resolve was previously necessary to interoperate with the non-unified frontend, because it hooked into iimport. It's no longer necessary with unified IR, where we can just lookup the ".inittask" symbol and access Def directly. Updates #57410. Change-Id: I73bdfd53f65988ececd2b777743cd8b591a6db48 Reviewed-on: https://go-review.googlesource.com/c/go/+/458616 Auto-Submit: Matthew Dempsky <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Keith Randall <[email protected]> Run-TryBot: Matthew Dempsky <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 4a0e84a commit 6d4101e

File tree

1 file changed

+4
-4
lines changed
  • src/cmd/compile/internal/pkginit

1 file changed

+4
-4
lines changed

src/cmd/compile/internal/pkginit/init.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ func Task() *ir.Name {
7575

7676
// Find imported packages with init tasks.
7777
for _, pkg := range typecheck.Target.Imports {
78-
n := typecheck.Resolve(ir.NewIdent(base.Pos, pkg.Lookup(".inittask")))
79-
if n.Op() == ir.ONONAME {
78+
n, ok := pkg.Lookup(".inittask").Def.(*ir.Name)
79+
if !ok {
8080
continue
8181
}
82-
if n.Op() != ir.ONAME || n.(*ir.Name).Class != ir.PEXTERN {
82+
if n.Op() != ir.ONAME || n.Class != ir.PEXTERN {
8383
base.Fatalf("bad inittask: %v", n)
8484
}
85-
deps = append(deps, n.(*ir.Name).Linksym())
85+
deps = append(deps, n.Linksym())
8686
}
8787
if base.Flag.ASan {
8888
// Make an initialization function to call runtime.asanregisterglobals to register an

0 commit comments

Comments
 (0)