go/gcimporter15: backport https://golang.org/cl/24648/
Change-Id: Id85050b236f5da2c705c45163c90fef1a396e8f8 Reviewed-on: https://go-review.googlesource.com/24700 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
0d2bde8553
commit
6c3528d5c1
|
@ -40,6 +40,9 @@ const debugFormat = false // default: false
|
|||
// If trace is set, debugging output is printed to std out.
|
||||
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"
|
||||
|
||||
// trackAllTypes enables cycle tracking for all types, not just named
|
||||
|
|
|
@ -26,6 +26,7 @@ type importer struct {
|
|||
data []byte
|
||||
path string
|
||||
buf []byte // for reading strings
|
||||
version string
|
||||
|
||||
// object lists
|
||||
strList []string // in order of appearance
|
||||
|
@ -75,8 +76,9 @@ func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []
|
|||
|
||||
// --- generic export data ---
|
||||
|
||||
if v := p.string(); v != "v0" {
|
||||
return p.read, nil, fmt.Errorf("unknown export data version: %s", v)
|
||||
p.version = p.string()
|
||||
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
|
||||
|
@ -344,6 +346,10 @@ func (p *importer) typ(parent *types.Package) types.Type {
|
|||
params, isddd := p.paramList()
|
||||
result, _ := p.paramList()
|
||||
|
||||
if p.version == "v1" {
|
||||
p.int() // nointerface flag - discarded
|
||||
}
|
||||
|
||||
sig := types.NewSignature(recv.At(0), params, result, isddd)
|
||||
t0.AddMethod(types.NewFunc(pos, parent, name, sig))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue