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:
3c8928fb5144f92ad9447e806e8d9b9ebf71003f
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>
+++ /dev/null
-// 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)
-}
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":