mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: generate Node methods using program
Add Node method generator by Matthew Dempsky, lightly adapted to account for a few special cases. No more writing these by hand. Change-Id: I6933b895df666928b851bddf81b994799c0c97f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/275434 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
d90b199e9c
commit
2cec6c4a8c
8 changed files with 1214 additions and 975 deletions
|
|
@ -9,7 +9,6 @@ import (
|
|||
"cmd/compile/internal/types"
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/src"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// A Func corresponds to a single function in a Go program
|
||||
|
|
@ -115,18 +114,6 @@ func NewFunc(pos src.XPos) *Func {
|
|||
return f
|
||||
}
|
||||
|
||||
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) doChildren(do func(Node) error) error {
|
||||
var err error
|
||||
err = maybeDoList(f.body, err, do)
|
||||
return err
|
||||
}
|
||||
func (f *Func) editChildren(edit func(Node) Node) {
|
||||
editList(f.body, edit)
|
||||
}
|
||||
|
||||
func (f *Func) Func() *Func { return f }
|
||||
func (f *Func) Body() Nodes { return f.body }
|
||||
func (f *Func) PtrBody() *Nodes { return &f.body }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue