mirror of
https://github.com/golang/go
synced 2024-11-20 09:34:52 -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:
parent
ad3e82e736
commit
ba25778f3f
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user