cmd/compile: respect -newescape in genwrapper

Noticed while preparing a CL for Go 1.14 to remove esc.go.

Change-Id: Ic12be33f5b16c8424d85f373fa450247be086078
Reviewed-on: https://go-review.googlesource.com/c/go/+/173298
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Matthew Dempsky 2019-04-22 16:08:43 -07:00
parent f0fdbb1e8b
commit a152dd0438
2 changed files with 7 additions and 4 deletions

View file

@ -46,11 +46,14 @@ import (
var newescape bool var newescape bool
func escapes(all []*Node) { func escapes(all []*Node) {
esc := escAnalyze visitBottomUp(all, escapeImpl())
}
func escapeImpl() func([]*Node, bool) {
if newescape { if newescape {
esc = escapeFuncs return escapeFuncs
} }
visitBottomUp(all, esc) return escAnalyze
} }
const ( const (

View file

@ -1574,7 +1574,7 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym) {
if rcvr.IsPtr() && rcvr.Elem() == method.Type.Recv().Type && rcvr.Elem().Sym != nil { if rcvr.IsPtr() && rcvr.Elem() == method.Type.Recv().Type && rcvr.Elem().Sym != nil {
inlcalls(fn) inlcalls(fn)
} }
escAnalyze([]*Node{fn}, false) escapeImpl()([]*Node{fn}, false)
Curfn = nil Curfn = nil
funccompile(fn) funccompile(fn)