mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: generalize ir/mknode.go
This CL generalizes ir/mknode.go to get rid of most of almost all of its special cases for node field types. The only remaining speciale case now is Field, which doesn't implement Node any more, but perhaps should. To help with removing special cases, node fields can now be tagged with `mknode:"-"` so that mknode ignores them when generating its helper methods. Further, to simplify skipping all of the orig fields, a new origNode helper type is added which declares an orig field marked as `mknode:"-"` and also provides the Orig and SetOrig methods needed to implement the OrigNode interface. Passes toolstash -cmp. Change-Id: Ic68d4f0a9d2ef6e57e9fe87cdc641e5c4859830b Reviewed-on: https://go-review.googlesource.com/c/go/+/280674 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
82ab3d1448
commit
499851bac8
9 changed files with 1071 additions and 706 deletions
|
|
@ -115,6 +115,10 @@ func NewFunc(pos src.XPos) *Func {
|
|||
|
||||
func (f *Func) isStmt() {}
|
||||
|
||||
func (n *Func) copy() Node { panic(n.no("copy")) }
|
||||
func (n *Func) doChildren(do func(Node) error) error { return doNodes(n.Body, do) }
|
||||
func (n *Func) editChildren(edit func(Node) Node) { editNodes(n.Body, edit) }
|
||||
|
||||
func (f *Func) Type() *types.Type { return f.Nname.Type() }
|
||||
func (f *Func) Sym() *types.Sym { return f.Nname.Sym() }
|
||||
func (f *Func) Linksym() *obj.LSym { return f.Nname.Linksym() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue