Skip to content

Commit a8facc4

Browse files
committed
cmd/compile/internal/typecheck: remove "name" handling in iimport.go
This hack is no longer needed since CL 393715, because LocalPkg.Prefix is set correctly, so when we write out instantiated objects/types into the export data, they'll already have a proper name. Updates #51734. Change-Id: I26cfa522f1bfdfd162685509757f51093b8b92e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/406318 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Matthew Dempsky <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]>
1 parent 2540f4e commit a8facc4

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/cmd/compile/internal/typecheck/iimport.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func ReadImports(pkg *types.Pkg, data string) {
193193
}
194194

195195
for nSyms := ird.uint64(); nSyms > 0; nSyms-- {
196-
s := pkg.Lookup(p.nameAt(ird.uint64()))
196+
s := pkg.Lookup(p.stringAt(ird.uint64()))
197197
off := ird.uint64()
198198

199199
if _, ok := DeclImporter[s]; !ok {
@@ -207,7 +207,7 @@ func ReadImports(pkg *types.Pkg, data string) {
207207
pkg := p.pkgAt(ird.uint64())
208208

209209
for nSyms := ird.uint64(); nSyms > 0; nSyms-- {
210-
s := pkg.Lookup(p.nameAt(ird.uint64()))
210+
s := pkg.Lookup(p.stringAt(ird.uint64()))
211211
off := ird.uint64()
212212

213213
if _, ok := inlineImporter[s]; !ok {
@@ -241,22 +241,6 @@ func (p *iimporter) stringAt(off uint64) string {
241241
return p.stringData[spos : spos+slen]
242242
}
243243

244-
// nameAt is the same as stringAt, except it replaces instances
245-
// of "" with the path of the package being imported.
246-
func (p *iimporter) nameAt(off uint64) string {
247-
s := p.stringAt(off)
248-
// Names of objects (functions, methods, globals) may include ""
249-
// to represent the path name of the imported package.
250-
// Replace "" with the imported package prefix. This occurs
251-
// specifically for generics where the names of instantiations
252-
// and dictionaries contain package-qualified type names.
253-
// Include the dot to avoid matching with struct tags ending in '"'.
254-
if strings.Contains(s, "\"\".") {
255-
s = strings.Replace(s, "\"\".", p.ipkg.Prefix+".", -1)
256-
}
257-
return s
258-
}
259-
260244
func (p *iimporter) posBaseAt(off uint64) *src.PosBase {
261245
if posBase, ok := p.posBaseCache[off]; ok {
262246
return posBase
@@ -312,7 +296,6 @@ func (p *iimporter) newReader(off uint64, pkg *types.Pkg) *importReader {
312296
}
313297

314298
func (r *importReader) string() string { return r.p.stringAt(r.uint64()) }
315-
func (r *importReader) name() string { return r.p.nameAt(r.uint64()) }
316299
func (r *importReader) posBase() *src.PosBase { return r.p.posBaseAt(r.uint64()) }
317300
func (r *importReader) pkg() *types.Pkg { return r.p.pkgAt(r.uint64()) }
318301

@@ -578,7 +561,7 @@ func (r *importReader) localIdent() *types.Sym { return r.ident(false) }
578561
func (r *importReader) selector() *types.Sym { return r.ident(true) }
579562

580563
func (r *importReader) qualifiedIdent() *ir.Ident {
581-
name := r.name()
564+
name := r.string()
582565
pkg := r.pkg()
583566
sym := pkg.Lookup(name)
584567
return ir.NewIdent(src.NoXPos, sym)

0 commit comments

Comments
 (0)