mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: implement doChildren for nodes
Put each node in charge of its DoChildren implementation. This removes a generic use of Left, Right, and so on in func DoChildren, heading toward removing those even from being used in package ir. Passes buildall w/ toolstash -cmp. Change-Id: Ibdf56f36801217cf24549e063da0078c1820a56b Reviewed-on: https://go-review.googlesource.com/c/go/+/275375 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
18f2df7e81
commit
4725c3ffd1
8 changed files with 419 additions and 67 deletions
|
|
@ -118,14 +118,20 @@ func NewFunc(pos src.XPos) *Func {
|
|||
func (f *Func) String() string { return fmt.Sprint(f) }
|
||||
func (f *Func) Format(s fmt.State, verb rune) { FmtNode(f, s, verb) }
|
||||
func (f *Func) copy() Node { panic(f.no("copy")) }
|
||||
func (f *Func) Func() *Func { return f }
|
||||
func (f *Func) Body() Nodes { return f.body }
|
||||
func (f *Func) PtrBody() *Nodes { return &f.body }
|
||||
func (f *Func) SetBody(x Nodes) { f.body = x }
|
||||
func (f *Func) Type() *types.Type { return f.typ }
|
||||
func (f *Func) SetType(x *types.Type) { f.typ = x }
|
||||
func (f *Func) Iota() int64 { return f.iota }
|
||||
func (f *Func) SetIota(x int64) { f.iota = x }
|
||||
func (f *Func) doChildren(do func(Node) error) error {
|
||||
var err error
|
||||
err = maybeDoList(f.body, err, do)
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *Func) Func() *Func { return f }
|
||||
func (f *Func) Body() Nodes { return f.body }
|
||||
func (f *Func) PtrBody() *Nodes { return &f.body }
|
||||
func (f *Func) SetBody(x Nodes) { f.body = x }
|
||||
func (f *Func) Type() *types.Type { return f.typ }
|
||||
func (f *Func) SetType(x *types.Type) { f.typ = x }
|
||||
func (f *Func) Iota() int64 { return f.iota }
|
||||
func (f *Func) SetIota(x int64) { f.iota = x }
|
||||
|
||||
func (f *Func) Sym() *types.Sym {
|
||||
if f.Nname != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue