mirror of https://github.com/golang/go.git
cmd/compile: remove redundant function pkgNameOf
Replace calls to pkgNameOf with calls to types2.Info.PkgNameOf.
Delete function pkgNameOf and file decl.go which are not needed anymore.
For #62037
Change-Id: Ib8a0411cc9eb9fdd42ee6e73c23deed2daaf73d5
GitHub-Last-Rev: 3c8928fb51
GitHub-Pull-Request: golang/go#64075
Reviewed-on: https://go-review.googlesource.com/c/go/+/541738
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
5f08b44799
commit
0c66ae5c27
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package noder
|
||||
|
||||
import (
|
||||
"cmd/compile/internal/syntax"
|
||||
"cmd/compile/internal/types2"
|
||||
)
|
||||
|
||||
// pkgNameOf returns the PkgName associated with the given ImportDecl.
|
||||
func pkgNameOf(info *types2.Info, decl *syntax.ImportDecl) *types2.PkgName {
|
||||
if name := decl.LocalPkgName; name != nil {
|
||||
return info.Defs[name].(*types2.PkgName)
|
||||
}
|
||||
return info.Implicits[decl].(*types2.PkgName)
|
||||
}
|
||||
|
|
@ -2484,7 +2484,7 @@ func (c *declCollector) Visit(n syntax.Node) syntax.Visitor {
|
|||
case *syntax.ImportDecl:
|
||||
pw.checkPragmas(n.Pragma, 0, false)
|
||||
|
||||
switch pkgNameOf(pw.info, n).Imported().Path() {
|
||||
switch pw.info.PkgNameOf(n).Imported().Path() {
|
||||
case "embed":
|
||||
c.file.importedEmbed = true
|
||||
case "unsafe":
|
||||
|
|
|
|||
Loading…
Reference in New Issue