mirror of
https://github.com/golang/go
synced 2024-09-30 20:28:32 -06:00
go/gcimporter15: update import/export to match std lib at tip
This change copies the respective changes from https://golang.org/cl/20605. There is a format conflict here - we are going to track tip, not 1.6. This change should fix the issue when testing against tip. Fixes golang/go#14824. Change-Id: I58e79cc65748e7a3e5c8486c6cee339884110a07 Reviewed-on: https://go-review.googlesource.com/20693 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
093d7650ab
commit
48737e9c89
@ -119,11 +119,9 @@ func BExportData(pkg *types.Package) []byte {
|
||||
p.int(len(funcs))
|
||||
for _, obj := range funcs {
|
||||
p.string(obj.Name())
|
||||
// The type can only be a signature for functions. However, by always
|
||||
// writing the complete type specification (rather than just a signature)
|
||||
// we keep the option open of sharing common signatures across multiple
|
||||
// functions as a means to further compress the export data.
|
||||
p.typ(obj.Type())
|
||||
sig := obj.Type().(*types.Signature)
|
||||
p.paramList(sig.Params(), sig.Variadic())
|
||||
p.paramList(sig.Results(), false)
|
||||
p.int(-1) // no inlined function bodies
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,9 @@ func BImportData(imports map[string]*types.Package, data []byte, path string) (i
|
||||
// read funcs
|
||||
for i := p.int(); i > 0; i-- {
|
||||
name := p.string()
|
||||
sig := p.typ(nil).(*types.Signature)
|
||||
params, isddd := p.paramList()
|
||||
result, _ := p.paramList()
|
||||
sig := types.NewSignature(nil, params, result, isddd)
|
||||
p.int() // read and discard index of inlined function body
|
||||
p.declare(types.NewFunc(token.NoPos, pkg, name, sig))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user