mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: add ir.PkgName
OPACK was using a whole Node and Name and Param to hold about three fields. Give it its own implementation. Passes buildall w/ toolstash -cmp. Change-Id: I85a28b43d37183b2062d337b0b1b2eea52884e8c Reviewed-on: https://go-review.googlesource.com/c/go/+/274093 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
420809ab08
commit
f6106d195d
6 changed files with 44 additions and 29 deletions
|
|
@ -955,8 +955,9 @@ func clearImports() {
|
|||
// leave s->block set to cause redeclaration
|
||||
// errors if a conflicting top-level name is
|
||||
// introduced by a different file.
|
||||
if !n.Name().Used() && base.SyntaxErrors() == 0 {
|
||||
unused = append(unused, importedPkg{n.Pos(), n.Name().Pkg.Path, s.Name})
|
||||
p := n.(*ir.PkgName)
|
||||
if !p.Used && base.SyntaxErrors() == 0 {
|
||||
unused = append(unused, importedPkg{p.Pos(), p.Pkg.Path, s.Name})
|
||||
}
|
||||
s.Def = nil
|
||||
continue
|
||||
|
|
@ -964,9 +965,9 @@ func clearImports() {
|
|||
if IsAlias(s) {
|
||||
// throw away top-level name left over
|
||||
// from previous import . "x"
|
||||
if n.Name() != nil && n.Name().Pack != nil && !n.Name().Pack.Name().Used() && base.SyntaxErrors() == 0 {
|
||||
unused = append(unused, importedPkg{n.Name().Pack.Pos(), n.Name().Pack.Name().Pkg.Path, ""})
|
||||
n.Name().Pack.Name().SetUsed(true)
|
||||
if name := n.Name(); name != nil && name.PkgName != nil && !name.PkgName.Used && base.SyntaxErrors() == 0 {
|
||||
unused = append(unused, importedPkg{name.PkgName.Pos(), name.PkgName.Pkg.Path, ""})
|
||||
name.PkgName.Used = true
|
||||
}
|
||||
s.Def = nil
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue