mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: extract common noding code from func{Decl,Lit}
Passes toolstash-check. Change-Id: I8290221d6169e077dfa4ea737d685c7fcecf6841 Reviewed-on: https://go-review.googlesource.com/100835 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
463fe95bdd
commit
29517daff9
2 changed files with 17 additions and 30 deletions
|
|
@ -26,18 +26,7 @@ func (p *noder) funcLit(expr *syntax.FuncLit) *Node {
|
|||
xfunc.Func.Closure = clo
|
||||
clo.Func.Closure = xfunc
|
||||
|
||||
oldScope := p.funchdr(xfunc)
|
||||
|
||||
body := p.stmts(expr.Body.List)
|
||||
if body == nil {
|
||||
body = []*Node{nod(OEMPTY, nil, nil)}
|
||||
}
|
||||
xfunc.Nbody.Set(body)
|
||||
|
||||
lineno = p.makeXPos(expr.Body.Rbrace)
|
||||
xfunc.Func.Endlineno = lineno
|
||||
|
||||
p.funcbody(oldScope)
|
||||
p.funcBody(xfunc, expr.Body)
|
||||
|
||||
// closure-specific variables are hanging off the
|
||||
// ordinary ones in the symbol table; see oldname.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue