diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-01-02 01:27:29 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-01-02 10:57:25 +0000 |
commit | f2538033c08a8c215a19610680d66f5909c5bcdd (patch) | |
tree | ea806dcd2e65c0609d2194cb204ae3937a6098d6 /src/cmd/compile/internal/noder/noder.go | |
parent | 2f2d4b4e68ab2fc448a1c2daf793b11ccde2fb16 (diff) | |
download | go-f2538033c08a8c215a19610680d66f5909c5bcdd.tar.gz go-f2538033c08a8c215a19610680d66f5909c5bcdd.zip |
[dev.regabi] cmd/compile: remove Nodes.Set [generated]
Just "=". It's cleaner.
Passes toolstash -cmp.
[git-generate]
cd src/cmd/compile/internal/ir
pkgs=$(go list . ../...)
rf '
ex '"$(echo $pkgs)"' {
var l Nodes
var p *Nodes
p.Set(l) -> *p = l
}
ex '"$(echo $pkgs)"' {
var n InitNode
var l Nodes
*n.PtrInit() = l -> n.SetInit(l)
}
rm Nodes.Set
'
Change-Id: Ic97219792243667146a02776553942ae1189ff7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/281002
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>
Diffstat (limited to 'src/cmd/compile/internal/noder/noder.go')
-rw-r--r-- | src/cmd/compile/internal/noder/noder.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go index 948833f46e..678e378291 100644 --- a/src/cmd/compile/internal/noder/noder.go +++ b/src/cmd/compile/internal/noder/noder.go @@ -245,7 +245,7 @@ func (p *noder) funcBody(fn *ir.Func, block *syntax.BlockStmt) { if body == nil { body = []ir.Node{ir.NewBlockStmt(base.Pos, nil)} } - fn.Body.Set(body) + fn.Body = body base.Pos = p.makeXPos(block.Rbrace) fn.Endlineno = base.Pos @@ -772,7 +772,7 @@ func (p *noder) expr(expr syntax.Expr) ir.Node { for i, e := range l { l[i] = p.wrapname(expr.ElemList[i], e) } - n.List.Set(l) + n.List = l base.Pos = p.makeXPos(expr.Rbrace) return n case *syntax.KeyValueExpr: @@ -1128,8 +1128,8 @@ func (p *noder) stmtFall(stmt syntax.Stmt, fallOK bool) ir.Node { if list, ok := stmt.Lhs.(*syntax.ListExpr); ok && len(list.ElemList) != 1 || len(rhs) != 1 { n := ir.NewAssignListStmt(p.pos(stmt), ir.OAS2, nil, nil) n.Def = stmt.Op == syntax.Def - n.Lhs.Set(p.assignList(stmt.Lhs, n, n.Def)) - n.Rhs.Set(rhs) + n.Lhs = p.assignList(stmt.Lhs, n, n.Def) + n.Rhs = rhs return n } @@ -1276,7 +1276,7 @@ func (p *noder) ifStmt(stmt *syntax.IfStmt) ir.Node { e := p.stmt(stmt.Else) if e.Op() == ir.OBLOCK { e := e.(*ir.BlockStmt) - n.Else.Set(e.List) + n.Else = e.List } else { n.Else = []ir.Node{e} } @@ -1301,7 +1301,7 @@ func (p *noder) forStmt(stmt *syntax.ForStmt) ir.Node { n.Value = lhs[1] } } - n.Body.Set(p.blockStmt(stmt.Body)) + n.Body = p.blockStmt(stmt.Body) p.closeAnotherScope() return n } @@ -1359,7 +1359,7 @@ func (p *noder) caseClauses(clauses []*syntax.CaseClause, tswitch *ir.TypeSwitch body = body[:len(body)-1] } - n.Body.Set(p.stmtsFall(body, true)) + n.Body = p.stmtsFall(body, true) if l := len(n.Body); l > 0 && n.Body[l-1].Op() == ir.OFALL { if tswitch != nil { base.Errorf("cannot fallthrough in type switch") |