mirror of
https://github.com/golang/go
synced 2024-11-24 16:50:13 -07:00
cmd/compile: use SetInit instead of *PtrInit
Change-Id: Ie802ff27b611ed248d7b14f6e972e6300c181f43 Reviewed-on: https://go-review.googlesource.com/c/go/+/358316 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
bc0eb5789e
commit
95372efc4d
@ -1259,7 +1259,7 @@ func (subst *inlsubst) node(n ir.Node) ir.Node {
|
|||||||
n := n.(*ir.BranchStmt)
|
n := n.(*ir.BranchStmt)
|
||||||
m := ir.Copy(n).(*ir.BranchStmt)
|
m := ir.Copy(n).(*ir.BranchStmt)
|
||||||
m.SetPos(subst.updatedPos(m.Pos()))
|
m.SetPos(subst.updatedPos(m.Pos()))
|
||||||
*m.PtrInit() = nil
|
m.SetInit(nil)
|
||||||
m.Label = translateLabel(n.Label)
|
m.Label = translateLabel(n.Label)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
@ -1271,7 +1271,7 @@ func (subst *inlsubst) node(n ir.Node) ir.Node {
|
|||||||
n := n.(*ir.LabelStmt)
|
n := n.(*ir.LabelStmt)
|
||||||
m := ir.Copy(n).(*ir.LabelStmt)
|
m := ir.Copy(n).(*ir.LabelStmt)
|
||||||
m.SetPos(subst.updatedPos(m.Pos()))
|
m.SetPos(subst.updatedPos(m.Pos()))
|
||||||
*m.PtrInit() = nil
|
m.SetInit(nil)
|
||||||
m.Label = translateLabel(n.Label)
|
m.Label = translateLabel(n.Label)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ func (p *noder) ifStmt(stmt *syntax.IfStmt) ir.Node {
|
|||||||
init := p.stmt(stmt.Init)
|
init := p.stmt(stmt.Init)
|
||||||
n := ir.NewIfStmt(p.pos(stmt), p.expr(stmt.Cond), p.blockStmt(stmt.Then), nil)
|
n := ir.NewIfStmt(p.pos(stmt), p.expr(stmt.Cond), p.blockStmt(stmt.Then), nil)
|
||||||
if init != nil {
|
if init != nil {
|
||||||
*n.PtrInit() = []ir.Node{init}
|
n.SetInit([]ir.Node{init})
|
||||||
}
|
}
|
||||||
if stmt.Else != nil {
|
if stmt.Else != nil {
|
||||||
e := p.stmt(stmt.Else)
|
e := p.stmt(stmt.Else)
|
||||||
@ -1285,7 +1285,7 @@ func (p *noder) switchStmt(stmt *syntax.SwitchStmt) ir.Node {
|
|||||||
init := p.stmt(stmt.Init)
|
init := p.stmt(stmt.Init)
|
||||||
n := ir.NewSwitchStmt(p.pos(stmt), p.expr(stmt.Tag), nil)
|
n := ir.NewSwitchStmt(p.pos(stmt), p.expr(stmt.Tag), nil)
|
||||||
if init != nil {
|
if init != nil {
|
||||||
*n.PtrInit() = []ir.Node{init}
|
n.SetInit([]ir.Node{init})
|
||||||
}
|
}
|
||||||
|
|
||||||
var tswitch *ir.TypeSwitchGuard
|
var tswitch *ir.TypeSwitchGuard
|
||||||
|
@ -482,7 +482,7 @@ func maplit(n *ir.CompLitExpr, m ir.Node, init *ir.Nodes) {
|
|||||||
|
|
||||||
loop := ir.NewForStmt(base.Pos, nil, cond, incr, nil)
|
loop := ir.NewForStmt(base.Pos, nil, cond, incr, nil)
|
||||||
loop.Body = []ir.Node{body}
|
loop.Body = []ir.Node{body}
|
||||||
*loop.PtrInit() = []ir.Node{zero}
|
loop.SetInit([]ir.Node{zero})
|
||||||
|
|
||||||
appendWalkStmt(init, loop)
|
appendWalkStmt(init, loop)
|
||||||
return
|
return
|
||||||
|
@ -105,7 +105,7 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node {
|
|||||||
n := cas.Comm
|
n := cas.Comm
|
||||||
ir.SetPos(n)
|
ir.SetPos(n)
|
||||||
r := ir.NewIfStmt(base.Pos, nil, nil, nil)
|
r := ir.NewIfStmt(base.Pos, nil, nil, nil)
|
||||||
*r.PtrInit() = cas.Init()
|
r.SetInit(cas.Init())
|
||||||
var cond ir.Node
|
var cond ir.Node
|
||||||
switch n.Op() {
|
switch n.Op() {
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user