mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/noder: refactor irgen import handling
Rather than re-parsing and re-resolving the import path string, use the PkgName object provided by types2 to determine what package path it refers to. Also, decompose importfile into smaller functions, so that we can directly pass the already-resolved package path to the importer. Finally, switch to simply using height as calculated by types2 rather than redoing the calculations. Change-Id: I3338f4e68387b2835b2e58d6df65d740d6a648cb Reviewed-on: https://go-review.googlesource.com/c/go/+/323309 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Trust: Dan Scales <danscales@google.com> Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
417955d151
commit
22f5ece3b1
3 changed files with 42 additions and 26 deletions
|
|
@ -98,6 +98,7 @@ type irgen struct {
|
|||
|
||||
func (g *irgen) generate(noders []*noder) {
|
||||
types.LocalPkg.Name = g.self.Name()
|
||||
types.LocalPkg.Height = g.self.Height()
|
||||
typecheck.TypecheckAllowed = true
|
||||
|
||||
// Prevent size calculations until we set the underlying type
|
||||
|
|
@ -132,8 +133,6 @@ Outer:
|
|||
}
|
||||
}
|
||||
}
|
||||
assert(myheight == g.self.Height())
|
||||
types.LocalPkg.Height = myheight
|
||||
|
||||
// 2. Process all package-block type declarations. As with imports,
|
||||
// we need to make sure all types are properly instantiated before
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue