mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: change Func.Cvars to the new Nodes type
Update #14473. Change-Id: Iba1ecf42d9ab5a93144941439d5cc6b0b4f4a3ac Reviewed-on: https://go-review.googlesource.com/19992 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7da4ceddd0
commit
922ce58de0
6 changed files with 12 additions and 33 deletions
|
|
@ -151,7 +151,7 @@ type Func struct {
|
|||
Shortname *Node
|
||||
Enter Nodes
|
||||
Exit Nodes
|
||||
cvars *[]*Node // closure params
|
||||
Cvars Nodes // closure params
|
||||
Dcl []*Node // autodcl for this func/closure
|
||||
Inldcl *[]*Node // copy of dcl for use in inlining
|
||||
Closgen int
|
||||
|
|
@ -177,27 +177,6 @@ type Func struct {
|
|||
Needctxt bool // function uses context register (has closure variables)
|
||||
}
|
||||
|
||||
// Cvars returns the closure variables for this Func.
|
||||
// These are referenced variables that are defined in enclosing
|
||||
// functions.
|
||||
// The cvars field is a pointer to save space, since most Func values
|
||||
// have no cvars.
|
||||
func (f *Func) Cvars() []*Node {
|
||||
if f.cvars == nil {
|
||||
return nil
|
||||
}
|
||||
return *f.cvars
|
||||
}
|
||||
|
||||
// AppendCvar appends a new closure variable.
|
||||
func (f *Func) CvarAppend(n *Node) {
|
||||
if f.cvars == nil {
|
||||
f.cvars = &[]*Node{n}
|
||||
} else {
|
||||
*f.cvars = append(*f.cvars, n)
|
||||
}
|
||||
}
|
||||
|
||||
type Op uint8
|
||||
|
||||
// Node ops.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue