From 48737e9c89cc5c10ef1a821ebe9ae2d01adb7f17 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 14 Mar 2016 17:25:30 -0700 Subject: [PATCH] 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 --- go/gcimporter15/bexport.go | 8 +++----- go/gcimporter15/bimport.go | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go/gcimporter15/bexport.go b/go/gcimporter15/bexport.go index f6a55734..53b93106 100644 --- a/go/gcimporter15/bexport.go +++ b/go/gcimporter15/bexport.go @@ -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 } diff --git a/go/gcimporter15/bimport.go b/go/gcimporter15/bimport.go index 08355a3b..0ec216e9 100644 --- a/go/gcimporter15/bimport.go +++ b/go/gcimporter15/bimport.go @@ -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)) }