From 78bc418f1d7f9346e3214ac40506624ab7f5f649 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 24 Aug 2016 13:12:34 -0700 Subject: [PATCH] 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 --- src/cmd/compile/internal/gc/bimport.go | 8 +++++++- src/cmd/compile/internal/gc/export.go | 28 -------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/cmd/compile/internal/gc/bimport.go b/src/cmd/compile/internal/gc/bimport.go index 65c845c93a..ff7ea418d1 100644 --- a/src/cmd/compile/internal/gc/bimport.go +++ b/src/cmd/compile/internal/gc/bimport.go @@ -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) diff --git a/src/cmd/compile/internal/gc/export.go b/src/cmd/compile/internal/gc/export.go index 3da93d5832..b982009cef 100644 --- a/src/cmd/compile/internal/gc/export.go +++ b/src/cmd/compile/internal/gc/export.go @@ -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) -- 2.48.1