Commit ba25778f authored by Luuk van Dijk's avatar Luuk van Dijk

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
parent ad3e82e7
......@@ -192,6 +192,10 @@ walkclosure(Node *func, NodeList **init)
Node *xtype, *xfunc, *call, *clos;
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
* with extra closure parameters.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment