Skip to content

Commit

Permalink
cmd/compile: remove unused importimport function
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
griesemer committed Aug 24, 2016
1 parent a99f812 commit 78bc418
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
8 changes: 7 additions & 1 deletion src/cmd/compile/internal/gc/bimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 0 additions & 28 deletions src/cmd/compile/internal/gc/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 78bc418

Please sign in to comment.