mirror of
https://github.com/golang/go
synced 2024-11-12 10:30:23 -07:00
cmd/compile: remove unused importimport function
Functionality is present in bimport.go in slightly modified form. Change-Id: I6be79d91588873e6ba70d6ab07ba2caa12346dfc Reviewed-on: https://go-review.googlesource.com/27672 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
a99f812cba
commit
78bc418f1d
@ -212,6 +212,12 @@ func (p *importer) verifyTypes() {
|
||||
}
|
||||
}
|
||||
|
||||
// numImport tracks how often a package with a given name is imported.
|
||||
// It is used to provide a better error message (by using the package
|
||||
// path to disambiguate) if a package that appears multiple times with
|
||||
// the same name appears in an error message.
|
||||
var numImport = make(map[string]int)
|
||||
|
||||
func (p *importer) pkg() *Pkg {
|
||||
// if the package was seen before, i is its index (>= 0)
|
||||
i := p.tagOrIndex()
|
||||
@ -244,7 +250,7 @@ func (p *importer) pkg() *Pkg {
|
||||
Fatalf("importer: package path %q for pkg index %d", path, len(p.pkgList))
|
||||
}
|
||||
|
||||
// see importimport (export.go)
|
||||
// add package to pkgList
|
||||
pkg := importpkg
|
||||
if path != "" {
|
||||
pkg = mkpkg(path)
|
||||
|
@ -295,34 +295,6 @@ func pkgtype(s *Sym) *Type {
|
||||
return s.Def.Type
|
||||
}
|
||||
|
||||
// numImport tracks how often a package with a given name is imported.
|
||||
// It is used to provide a better error message (by using the package
|
||||
// path to disambiguate) if a package that appears multiple times with
|
||||
// the same name appears in an error message.
|
||||
var numImport = make(map[string]int)
|
||||
|
||||
func importimport(s *Sym, path string) {
|
||||
// Informational: record package name
|
||||
// associated with import path, for use in
|
||||
// human-readable messages.
|
||||
|
||||
if isbadimport(path) {
|
||||
errorexit()
|
||||
}
|
||||
p := mkpkg(path)
|
||||
if p.Name == "" {
|
||||
p.Name = s.Name
|
||||
numImport[s.Name]++
|
||||
} else if p.Name != s.Name {
|
||||
Yyerror("conflicting names %s and %s for package %q", p.Name, s.Name, p.Path)
|
||||
}
|
||||
|
||||
if incannedimport == 0 && myimportpath != "" && path == myimportpath {
|
||||
Yyerror("import %q: package depends on %q (import cycle)", importpkg.Path, path)
|
||||
errorexit()
|
||||
}
|
||||
}
|
||||
|
||||
// importconst declares symbol s as an imported constant with type t and value n.
|
||||
func importconst(s *Sym, t *Type, n *Node) {
|
||||
importsym(s, OLITERAL)
|
||||
|
Loading…
Reference in New Issue
Block a user