cmd/compile: import/export of alias declarations

This CL completes support for alias declarations in the compiler.

Also:
- increased export format version
- updated various comments

For #16339.
Fixes #17487.

Change-Id: Ic6945fc44c0041771eaf9dcfe973f601d14de069
Reviewed-on: https://go-review.googlesource.com/32090
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2016-10-25 14:09:18 -07:00
parent 81038d2e2b
commit 03d81b5ed9
11 changed files with 291 additions and 61 deletions

View file

@ -928,7 +928,7 @@ func mkpackage(pkgname string) {
continue
}
if s.Def.Sym != s {
if s.Def.Sym != s && s.Flags&SymAlias == 0 {
// throw away top-level name left over
// from previous import . "x"
if s.Def.Name != nil && s.Def.Name.Pack != nil && !s.Def.Name.Pack.Used && nsyntaxerrors == 0 {
@ -936,8 +936,6 @@ func mkpackage(pkgname string) {
s.Def.Name.Pack.Used = true
}
// TODO(gri) This will also affect exported aliases.
// Need to fix this.
s.Def = nil
continue
}