1
0
mirror of https://github.com/golang/go synced 2024-11-20 11:34:48 -07:00

gc: omit runtime.closure wrap for closures without closure variables

Fixes #1894.

test/closure.go's test for newfunc already covers this.

R=rsc, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5516051
This commit is contained in:
Luuk van Dijk 2012-01-10 11:07:35 +01:00
parent ad3e82e736
commit ba25778f3f

View File

@ -192,6 +192,10 @@ walkclosure(Node *func, NodeList **init)
Node *xtype, *xfunc, *call, *clos; Node *xtype, *xfunc, *call, *clos;
NodeList *l, *in; NodeList *l, *in;
// no closure vars, don't bother wrapping
if(func->cvars == nil)
return makeclosure(func, init, 1)->nname;
/* /*
* wrap body in external function * wrap body in external function
* with extra closure parameters. * with extra closure parameters.