Change-Id: Id85050b236f5da2c705c45163c90fef1a396e8f8
Reviewed-on: https://go-review.googlesource.com/24700
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2016-07-01 11:19:09 -07:00
parent 0d2bde8553
commit 6c3528d5c1
2 changed files with 11 additions and 2 deletions

View File

@ -40,6 +40,9 @@ const debugFormat = false // default: false
// If trace is set, debugging output is printed to std out. // If trace is set, debugging output is printed to std out.
const trace = false // default: false const trace = false // default: false
// This version doesn't write the nointerface flag for exported methods.
// The corresponding importer handles both "v0" and "v1".
// See also issues #16243, #16244.
const exportVersion = "v0" const exportVersion = "v0"
// trackAllTypes enables cycle tracking for all types, not just named // trackAllTypes enables cycle tracking for all types, not just named

View File

@ -26,6 +26,7 @@ type importer struct {
data []byte data []byte
path string path string
buf []byte // for reading strings buf []byte // for reading strings
version string
// object lists // object lists
strList []string // in order of appearance strList []string // in order of appearance
@ -75,8 +76,9 @@ func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []
// --- generic export data --- // --- generic export data ---
if v := p.string(); v != "v0" { p.version = p.string()
return p.read, nil, fmt.Errorf("unknown export data version: %s", v) if p.version != "v0" && p.version != "v1" {
return p.read, nil, fmt.Errorf("unknown export data version: %s", p.version)
} }
// populate typList with predeclared "known" types // populate typList with predeclared "known" types
@ -344,6 +346,10 @@ func (p *importer) typ(parent *types.Package) types.Type {
params, isddd := p.paramList() params, isddd := p.paramList()
result, _ := p.paramList() result, _ := p.paramList()
if p.version == "v1" {
p.int() // nointerface flag - discarded
}
sig := types.NewSignature(recv.At(0), params, result, isddd) sig := types.NewSignature(recv.At(0), params, result, isddd)
t0.AddMethod(types.NewFunc(pos, parent, name, sig)) t0.AddMethod(types.NewFunc(pos, parent, name, sig))
} }