]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use SetInit instead of *PtrInit
authorwdvxdr <wdvxdr1123@gmail.com>
Mon, 25 Oct 2021 10:15:43 +0000 (18:15 +0800)
committerDan Scales <danscales@google.com>
Mon, 25 Oct 2021 17:29:14 +0000 (17:29 +0000)
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>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/walk/complit.go
src/cmd/compile/internal/walk/select.go

index 1ae6a58de062766cc17ecb2afc85af91f44a904e..483b3d5d46fe6127b03791d6fb27cc7fd6e30243 100644 (file)
@@ -1259,7 +1259,7 @@ func (subst *inlsubst) node(n ir.Node) ir.Node {
                n := n.(*ir.BranchStmt)
                m := ir.Copy(n).(*ir.BranchStmt)
                m.SetPos(subst.updatedPos(m.Pos()))
-               *m.PtrInit() = nil
+               m.SetInit(nil)
                m.Label = translateLabel(n.Label)
                return m
 
@@ -1271,7 +1271,7 @@ func (subst *inlsubst) node(n ir.Node) ir.Node {
                n := n.(*ir.LabelStmt)
                m := ir.Copy(n).(*ir.LabelStmt)
                m.SetPos(subst.updatedPos(m.Pos()))
-               *m.PtrInit() = nil
+               m.SetInit(nil)
                m.Label = translateLabel(n.Label)
                return m
 
index 7c14fcf04163bb557faaab267c95af89de979efb..fc1541f74ee9cf6cf6e63bf603958cb1f80cc887 100644 (file)
@@ -1238,7 +1238,7 @@ func (p *noder) ifStmt(stmt *syntax.IfStmt) ir.Node {
        init := p.stmt(stmt.Init)
        n := ir.NewIfStmt(p.pos(stmt), p.expr(stmt.Cond), p.blockStmt(stmt.Then), nil)
        if init != nil {
-               *n.PtrInit() = []ir.Node{init}
+               n.SetInit([]ir.Node{init})
        }
        if stmt.Else != nil {
                e := p.stmt(stmt.Else)
@@ -1285,7 +1285,7 @@ func (p *noder) switchStmt(stmt *syntax.SwitchStmt) ir.Node {
        init := p.stmt(stmt.Init)
        n := ir.NewSwitchStmt(p.pos(stmt), p.expr(stmt.Tag), nil)
        if init != nil {
-               *n.PtrInit() = []ir.Node{init}
+               n.SetInit([]ir.Node{init})
        }
 
        var tswitch *ir.TypeSwitchGuard
index ad54fa7b969a44ca53f3621b2a76aac97b4662c2..b985b4caeb8597ec7387cb7ca24eb4cde01e5c0d 100644 (file)
@@ -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.Body = []ir.Node{body}
-               *loop.PtrInit() = []ir.Node{zero}
+               loop.SetInit([]ir.Node{zero})
 
                appendWalkStmt(init, loop)
                return
index d2b67ddf55a7abc8d5ccba5dc9d991aa7cd7fd2e..fde8f5089590fbc2984a6fb2c98d2d1e0e0412f0 100644 (file)
@@ -105,7 +105,7 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node {
                n := cas.Comm
                ir.SetPos(n)
                r := ir.NewIfStmt(base.Pos, nil, nil, nil)
-               *r.PtrInit() = cas.Init()
+               r.SetInit(cas.Init())
                var cond ir.Node
                switch n.Op() {
                default: