1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 "cmd/compile/internal/syntax"
9 "cmd/compile/internal/types2"
12 // pkgNameOf returns the PkgName associated with the given ImportDecl.
13 func pkgNameOf(info *types2.Info, decl *syntax.ImportDecl) *types2.PkgName {
14 if name := decl.LocalPkgName; name != nil {
15 return info.Defs[name].(*types2.PkgName)
17 return info.Implicits[decl].(*types2.PkgName)