From ecff7628ead3b0191f5fe191864ee47fcc90bb92 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 30 Nov 2020 21:20:45 -0500 Subject: [PATCH] [dev.regabi] cmd/compile: unexport Node.RawCopy RawCopy breaks the invariant that ir.Orig depends on for allowing nodes to omit keeping their own orig fields. Avoid surprises by unexporting it. The only use in package gc was removed in the previous CL. This one is a straight global search and replace RawCopy -> rawCopy. Change-Id: Ia99c0f4665bf7ed4f878cc44456d5fbdf33bab8d Reviewed-on: https://go-review.googlesource.com/c/go/+/274293 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Matthew Dempsky TryBot-Result: Go Bot --- src/cmd/compile/internal/ir/copy.go | 4 +-- src/cmd/compile/internal/ir/expr.go | 46 ++++++++++++++--------------- src/cmd/compile/internal/ir/func.go | 2 +- src/cmd/compile/internal/ir/mini.go | 2 +- src/cmd/compile/internal/ir/name.go | 4 +-- src/cmd/compile/internal/ir/node.go | 2 +- src/cmd/compile/internal/ir/stmt.go | 40 ++++++++++++------------- src/cmd/compile/internal/ir/type.go | 16 +++++----- 8 files changed, 58 insertions(+), 58 deletions(-) diff --git a/src/cmd/compile/internal/ir/copy.go b/src/cmd/compile/internal/ir/copy.go index 7a1611d0d6..a356074bb8 100644 --- a/src/cmd/compile/internal/ir/copy.go +++ b/src/cmd/compile/internal/ir/copy.go @@ -43,7 +43,7 @@ func Orig(n Node) Node { // SepCopy returns a separate shallow copy of n, // breaking any Orig link to any other nodes. func SepCopy(n Node) Node { - n = n.RawCopy() + n = n.rawCopy() if n, ok := n.(OrigNode); ok { n.SetOrig(n) } @@ -57,7 +57,7 @@ func SepCopy(n Node) Node { // The specific semantics surrounding Orig are subtle but right for most uses. // See issues #26855 and #27765 for pitfalls. func Copy(n Node) Node { - copy := n.RawCopy() + copy := n.rawCopy() if n, ok := n.(OrigNode); ok && n.Orig() == n { copy.(OrigNode).SetOrig(copy) } diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go index be9f486682..87593520a1 100644 --- a/src/cmd/compile/internal/ir/expr.go +++ b/src/cmd/compile/internal/ir/expr.go @@ -75,7 +75,7 @@ func NewAddStringExpr(pos src.XPos, list []Node) *AddStringExpr { func (n *AddStringExpr) String() string { return fmt.Sprint(n) } func (n *AddStringExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *AddStringExpr) RawCopy() Node { c := *n; return &c } +func (n *AddStringExpr) rawCopy() Node { c := *n; return &c } func (n *AddStringExpr) List() Nodes { return n.list } func (n *AddStringExpr) PtrList() *Nodes { return &n.list } func (n *AddStringExpr) SetList(x Nodes) { n.list = x } @@ -97,7 +97,7 @@ func NewAddrExpr(pos src.XPos, x Node) *AddrExpr { func (n *AddrExpr) String() string { return fmt.Sprint(n) } func (n *AddrExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *AddrExpr) RawCopy() Node { c := *n; return &c } +func (n *AddrExpr) rawCopy() Node { c := *n; return &c } func (n *AddrExpr) Left() Node { return n.X } func (n *AddrExpr) SetLeft(x Node) { n.X = x } func (n *AddrExpr) Right() Node { return n.Alloc } @@ -129,7 +129,7 @@ func NewBinaryExpr(pos src.XPos, op Op, x, y Node) *BinaryExpr { func (n *BinaryExpr) String() string { return fmt.Sprint(n) } func (n *BinaryExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *BinaryExpr) RawCopy() Node { c := *n; return &c } +func (n *BinaryExpr) rawCopy() Node { c := *n; return &c } func (n *BinaryExpr) Left() Node { return n.X } func (n *BinaryExpr) SetLeft(x Node) { n.X = x } func (n *BinaryExpr) Right() Node { return n.Y } @@ -170,7 +170,7 @@ func NewCallExpr(pos src.XPos, fun Node, args []Node) *CallExpr { func (n *CallExpr) String() string { return fmt.Sprint(n) } func (n *CallExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *CallExpr) RawCopy() Node { c := *n; return &c } +func (n *CallExpr) rawCopy() Node { c := *n; return &c } func (n *CallExpr) Orig() Node { return n.orig } func (n *CallExpr) SetOrig(x Node) { n.orig = x } func (n *CallExpr) Left() Node { return n.X } @@ -218,7 +218,7 @@ func NewCallPartExpr(pos src.XPos, x Node, method *Name, fn *Func) *CallPartExpr func (n *CallPartExpr) String() string { return fmt.Sprint(n) } func (n *CallPartExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *CallPartExpr) RawCopy() Node { c := *n; return &c } +func (n *CallPartExpr) rawCopy() Node { c := *n; return &c } func (n *CallPartExpr) Func() *Func { return n.fn } func (n *CallPartExpr) Left() Node { return n.X } func (n *CallPartExpr) Right() Node { return n.Method } @@ -240,7 +240,7 @@ func NewClosureExpr(pos src.XPos, fn *Func) *ClosureExpr { func (n *ClosureExpr) String() string { return fmt.Sprint(n) } func (n *ClosureExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ClosureExpr) RawCopy() Node { c := *n; return &c } +func (n *ClosureExpr) rawCopy() Node { c := *n; return &c } func (n *ClosureExpr) Func() *Func { return n.fn } // A ClosureRead denotes reading a variable stored within a closure struct. @@ -258,7 +258,7 @@ func NewClosureRead(typ *types.Type, offset int64) *ClosureRead { func (n *ClosureRead) String() string { return fmt.Sprint(n) } func (n *ClosureRead) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ClosureRead) RawCopy() Node { c := *n; return &c } +func (n *ClosureRead) rawCopy() Node { c := *n; return &c } func (n *ClosureRead) Type() *types.Type { return n.typ } func (n *ClosureRead) Offset() int64 { return n.offset } @@ -282,7 +282,7 @@ func NewCompLitExpr(pos src.XPos, typ Ntype, list []Node) *CompLitExpr { func (n *CompLitExpr) String() string { return fmt.Sprint(n) } func (n *CompLitExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *CompLitExpr) RawCopy() Node { c := *n; return &c } +func (n *CompLitExpr) rawCopy() Node { c := *n; return &c } func (n *CompLitExpr) Orig() Node { return n.orig } func (n *CompLitExpr) SetOrig(x Node) { n.orig = x } func (n *CompLitExpr) Right() Node { return n.Ntype } @@ -319,7 +319,7 @@ func NewConvExpr(pos src.XPos, op Op, typ *types.Type, x Node) *ConvExpr { func (n *ConvExpr) String() string { return fmt.Sprint(n) } func (n *ConvExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ConvExpr) RawCopy() Node { c := *n; return &c } +func (n *ConvExpr) rawCopy() Node { c := *n; return &c } func (n *ConvExpr) Orig() Node { return n.orig } func (n *ConvExpr) SetOrig(x Node) { n.orig = x } func (n *ConvExpr) Left() Node { return n.X } @@ -351,7 +351,7 @@ func NewIndexExpr(pos src.XPos, x, index Node) *IndexExpr { func (n *IndexExpr) String() string { return fmt.Sprint(n) } func (n *IndexExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *IndexExpr) RawCopy() Node { c := *n; return &c } +func (n *IndexExpr) rawCopy() Node { c := *n; return &c } func (n *IndexExpr) Left() Node { return n.X } func (n *IndexExpr) SetLeft(x Node) { n.X = x } func (n *IndexExpr) Right() Node { return n.Index } @@ -388,7 +388,7 @@ func NewKeyExpr(pos src.XPos, key, value Node) *KeyExpr { func (n *KeyExpr) String() string { return fmt.Sprint(n) } func (n *KeyExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *KeyExpr) RawCopy() Node { c := *n; return &c } +func (n *KeyExpr) rawCopy() Node { c := *n; return &c } func (n *KeyExpr) Left() Node { return n.Key } func (n *KeyExpr) SetLeft(x Node) { n.Key = x } func (n *KeyExpr) Right() Node { return n.Value } @@ -425,7 +425,7 @@ func NewInlinedCallExpr(pos src.XPos, body, retvars []Node) *InlinedCallExpr { func (n *InlinedCallExpr) String() string { return fmt.Sprint(n) } func (n *InlinedCallExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *InlinedCallExpr) RawCopy() Node { c := *n; return &c } +func (n *InlinedCallExpr) rawCopy() Node { c := *n; return &c } func (n *InlinedCallExpr) Body() Nodes { return n.body } func (n *InlinedCallExpr) PtrBody() *Nodes { return &n.body } func (n *InlinedCallExpr) SetBody(x Nodes) { n.body = x } @@ -451,7 +451,7 @@ func NewMakeExpr(pos src.XPos, op Op, len, cap Node) *MakeExpr { func (n *MakeExpr) String() string { return fmt.Sprint(n) } func (n *MakeExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *MakeExpr) RawCopy() Node { c := *n; return &c } +func (n *MakeExpr) rawCopy() Node { c := *n; return &c } func (n *MakeExpr) Left() Node { return n.Len } func (n *MakeExpr) SetLeft(x Node) { n.Len = x } func (n *MakeExpr) Right() Node { return n.Cap } @@ -486,7 +486,7 @@ func NewMethodExpr(pos src.XPos, op Op, x, m Node) *MethodExpr { func (n *MethodExpr) String() string { return fmt.Sprint(n) } func (n *MethodExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *MethodExpr) RawCopy() Node { c := *n; return &c } +func (n *MethodExpr) rawCopy() Node { c := *n; return &c } func (n *MethodExpr) Left() Node { return n.X } func (n *MethodExpr) SetLeft(x Node) { n.X = x } func (n *MethodExpr) Right() Node { return n.M } @@ -514,7 +514,7 @@ func NewNilExpr(pos src.XPos) *NilExpr { func (n *NilExpr) String() string { return fmt.Sprint(n) } func (n *NilExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *NilExpr) RawCopy() Node { c := *n; return &c } +func (n *NilExpr) rawCopy() Node { c := *n; return &c } func (n *NilExpr) Sym() *types.Sym { return n.sym } func (n *NilExpr) SetSym(x *types.Sym) { n.sym = x } @@ -534,7 +534,7 @@ func NewParenExpr(pos src.XPos, x Node) *ParenExpr { func (n *ParenExpr) String() string { return fmt.Sprint(n) } func (n *ParenExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ParenExpr) RawCopy() Node { c := *n; return &c } +func (n *ParenExpr) rawCopy() Node { c := *n; return &c } func (n *ParenExpr) Left() Node { return n.X } func (n *ParenExpr) SetLeft(x Node) { n.X = x } @@ -566,7 +566,7 @@ func NewResultExpr(pos src.XPos, typ *types.Type, offset int64) *ResultExpr { func (n *ResultExpr) String() string { return fmt.Sprint(n) } func (n *ResultExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ResultExpr) RawCopy() Node { c := *n; return &c } +func (n *ResultExpr) rawCopy() Node { c := *n; return &c } func (n *ResultExpr) Offset() int64 { return n.offset } func (n *ResultExpr) SetOffset(x int64) { n.offset = x } @@ -597,7 +597,7 @@ func (n *SelectorExpr) SetOp(op Op) { func (n *SelectorExpr) String() string { return fmt.Sprint(n) } func (n *SelectorExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SelectorExpr) RawCopy() Node { c := *n; return &c } +func (n *SelectorExpr) rawCopy() Node { c := *n; return &c } func (n *SelectorExpr) Left() Node { return n.X } func (n *SelectorExpr) SetLeft(x Node) { n.X = x } func (n *SelectorExpr) Sym() *types.Sym { return n.Sel } @@ -625,7 +625,7 @@ func NewSliceExpr(pos src.XPos, op Op, x Node) *SliceExpr { func (n *SliceExpr) String() string { return fmt.Sprint(n) } func (n *SliceExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SliceExpr) RawCopy() Node { c := *n; return &c } +func (n *SliceExpr) rawCopy() Node { c := *n; return &c } func (n *SliceExpr) Left() Node { return n.X } func (n *SliceExpr) SetLeft(x Node) { n.X = x } func (n *SliceExpr) List() Nodes { return n.list } @@ -727,7 +727,7 @@ func NewSliceHeaderExpr(pos src.XPos, typ *types.Type, ptr, len, cap Node) *Slic func (n *SliceHeaderExpr) String() string { return fmt.Sprint(n) } func (n *SliceHeaderExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SliceHeaderExpr) RawCopy() Node { c := *n; return &c } +func (n *SliceHeaderExpr) rawCopy() Node { c := *n; return &c } func (n *SliceHeaderExpr) Left() Node { return n.Ptr } func (n *SliceHeaderExpr) SetLeft(x Node) { n.Ptr = x } func (n *SliceHeaderExpr) List() Nodes { return n.lenCap } @@ -750,7 +750,7 @@ func NewStarExpr(pos src.XPos, x Node) *StarExpr { func (n *StarExpr) String() string { return fmt.Sprint(n) } func (n *StarExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *StarExpr) RawCopy() Node { c := *n; return &c } +func (n *StarExpr) rawCopy() Node { c := *n; return &c } func (n *StarExpr) Left() Node { return n.X } func (n *StarExpr) SetLeft(x Node) { n.X = x } @@ -796,7 +796,7 @@ func NewTypeAssertExpr(pos src.XPos, x Node, typ Ntype) *TypeAssertExpr { func (n *TypeAssertExpr) String() string { return fmt.Sprint(n) } func (n *TypeAssertExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *TypeAssertExpr) RawCopy() Node { c := *n; return &c } +func (n *TypeAssertExpr) rawCopy() Node { c := *n; return &c } func (n *TypeAssertExpr) Left() Node { return n.X } func (n *TypeAssertExpr) SetLeft(x Node) { n.X = x } func (n *TypeAssertExpr) Right() Node { return n.Ntype } @@ -830,7 +830,7 @@ func NewUnaryExpr(pos src.XPos, op Op, x Node) *UnaryExpr { func (n *UnaryExpr) String() string { return fmt.Sprint(n) } func (n *UnaryExpr) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *UnaryExpr) RawCopy() Node { c := *n; return &c } +func (n *UnaryExpr) rawCopy() Node { c := *n; return &c } func (n *UnaryExpr) Left() Node { return n.X } func (n *UnaryExpr) SetLeft(x Node) { n.X = x } diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go index 9d2a8ad94b..3fc8597ef0 100644 --- a/src/cmd/compile/internal/ir/func.go +++ b/src/cmd/compile/internal/ir/func.go @@ -116,7 +116,7 @@ func NewFunc(pos src.XPos) *Func { 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) RawCopy() Node { panic(f.no("RawCopy")) } +func (f *Func) rawCopy() Node { panic(f.no("rawCopy")) } func (f *Func) Func() *Func { return f } func (f *Func) Body() Nodes { return f.body } func (f *Func) PtrBody() *Nodes { return &f.body } diff --git a/src/cmd/compile/internal/ir/mini.go b/src/cmd/compile/internal/ir/mini.go index d73ec4ecd5..909ca0220d 100644 --- a/src/cmd/compile/internal/ir/mini.go +++ b/src/cmd/compile/internal/ir/mini.go @@ -19,7 +19,7 @@ import ( // must at the least provide: // // func (n *MyNode) String() string { return fmt.Sprint(n) } -// func (n *MyNode) RawCopy() Node { c := *n; return &c } +// func (n *MyNode) rawCopy() Node { c := *n; return &c } // func (n *MyNode) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } // // The embedding struct should also fill in n.op in its constructor, diff --git a/src/cmd/compile/internal/ir/name.go b/src/cmd/compile/internal/ir/name.go index 1bc6bea3b6..76abb454ee 100644 --- a/src/cmd/compile/internal/ir/name.go +++ b/src/cmd/compile/internal/ir/name.go @@ -143,7 +143,7 @@ func newNameAt(pos src.XPos, sym *types.Sym) *Name { func (n *Name) String() string { return fmt.Sprint(n) } func (n *Name) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *Name) RawCopy() Node { c := *n; return &c } +func (n *Name) rawCopy() Node { c := *n; return &c } func (n *Name) Name() *Name { return n } func (n *Name) Sym() *types.Sym { return n.sym } func (n *Name) SetSym(x *types.Sym) { n.sym = x } @@ -370,7 +370,7 @@ type PkgName struct { func (p *PkgName) String() string { return fmt.Sprint(p) } func (p *PkgName) Format(s fmt.State, verb rune) { FmtNode(p, s, verb) } -func (p *PkgName) RawCopy() Node { c := *p; return &c } +func (p *PkgName) rawCopy() Node { c := *p; return &c } func (p *PkgName) Sym() *types.Sym { return p.sym } func (*PkgName) CanBeNtype() {} diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go index a93a87fb68..a7144eee44 100644 --- a/src/cmd/compile/internal/ir/node.go +++ b/src/cmd/compile/internal/ir/node.go @@ -28,7 +28,7 @@ type Node interface { SetPos(x src.XPos) // For making copies. Mainly used by Copy and SepCopy. - RawCopy() Node + rawCopy() Node // Abstract graph structure, for generic traversals. Op() Op diff --git a/src/cmd/compile/internal/ir/stmt.go b/src/cmd/compile/internal/ir/stmt.go index 2516835513..91714e38e3 100644 --- a/src/cmd/compile/internal/ir/stmt.go +++ b/src/cmd/compile/internal/ir/stmt.go @@ -31,7 +31,7 @@ func NewDecl(pos src.XPos, op Op, x Node) *Decl { func (n *Decl) String() string { return fmt.Sprint(n) } func (n *Decl) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *Decl) RawCopy() Node { c := *n; return &c } +func (n *Decl) rawCopy() Node { c := *n; return &c } func (n *Decl) Left() Node { return n.X } func (n *Decl) SetLeft(x Node) { n.X = x } @@ -70,7 +70,7 @@ func NewAssignListStmt(pos src.XPos, lhs, rhs []Node) *AssignListStmt { func (n *AssignListStmt) String() string { return fmt.Sprint(n) } func (n *AssignListStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *AssignListStmt) RawCopy() Node { c := *n; return &c } +func (n *AssignListStmt) rawCopy() Node { c := *n; return &c } func (n *AssignListStmt) List() Nodes { return n.Lhs } func (n *AssignListStmt) PtrList() *Nodes { return &n.Lhs } @@ -112,7 +112,7 @@ func NewAssignStmt(pos src.XPos, x, y Node) *AssignStmt { func (n *AssignStmt) String() string { return fmt.Sprint(n) } func (n *AssignStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *AssignStmt) RawCopy() Node { c := *n; return &c } +func (n *AssignStmt) rawCopy() Node { c := *n; return &c } func (n *AssignStmt) Left() Node { return n.X } func (n *AssignStmt) SetLeft(x Node) { n.X = x } @@ -151,7 +151,7 @@ func NewAssignOpStmt(pos src.XPos, op Op, x, y Node) *AssignOpStmt { func (n *AssignOpStmt) String() string { return fmt.Sprint(n) } func (n *AssignOpStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *AssignOpStmt) RawCopy() Node { c := *n; return &c } +func (n *AssignOpStmt) rawCopy() Node { c := *n; return &c } func (n *AssignOpStmt) Left() Node { return n.X } func (n *AssignOpStmt) SetLeft(x Node) { n.X = x } @@ -180,7 +180,7 @@ func NewBlockStmt(pos src.XPos, list []Node) *BlockStmt { func (n *BlockStmt) String() string { return fmt.Sprint(n) } func (n *BlockStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *BlockStmt) RawCopy() Node { c := *n; return &c } +func (n *BlockStmt) rawCopy() Node { c := *n; return &c } func (n *BlockStmt) List() Nodes { return n.list } func (n *BlockStmt) PtrList() *Nodes { return &n.list } func (n *BlockStmt) SetList(x Nodes) { n.list = x } @@ -209,7 +209,7 @@ func NewBranchStmt(pos src.XPos, op Op, label *types.Sym) *BranchStmt { func (n *BranchStmt) String() string { return fmt.Sprint(n) } func (n *BranchStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *BranchStmt) RawCopy() Node { c := *n; return &c } +func (n *BranchStmt) rawCopy() Node { c := *n; return &c } func (n *BranchStmt) Sym() *types.Sym { return n.Label } func (n *BranchStmt) SetSym(sym *types.Sym) { n.Label = sym } @@ -233,7 +233,7 @@ func NewCaseStmt(pos src.XPos, list, body []Node) *CaseStmt { func (n *CaseStmt) String() string { return fmt.Sprint(n) } func (n *CaseStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *CaseStmt) RawCopy() Node { c := *n; return &c } +func (n *CaseStmt) rawCopy() Node { c := *n; return &c } func (n *CaseStmt) List() Nodes { return n.list } func (n *CaseStmt) PtrList() *Nodes { return &n.list } func (n *CaseStmt) SetList(x Nodes) { n.list = x } @@ -261,7 +261,7 @@ func NewDeferStmt(pos src.XPos, call Node) *DeferStmt { func (n *DeferStmt) String() string { return fmt.Sprint(n) } func (n *DeferStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *DeferStmt) RawCopy() Node { c := *n; return &c } +func (n *DeferStmt) rawCopy() Node { c := *n; return &c } func (n *DeferStmt) Left() Node { return n.Call } func (n *DeferStmt) SetLeft(x Node) { n.Call = x } @@ -280,7 +280,7 @@ func NewEmptyStmt(pos src.XPos) *EmptyStmt { func (n *EmptyStmt) String() string { return fmt.Sprint(n) } func (n *EmptyStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *EmptyStmt) RawCopy() Node { c := *n; return &c } +func (n *EmptyStmt) rawCopy() Node { c := *n; return &c } // A ForStmt is a non-range for loop: for Init; Cond; Post { Body } // Op can be OFOR or OFORUNTIL (!Cond). @@ -305,7 +305,7 @@ func NewForStmt(pos src.XPos, init []Node, cond, post Node, body []Node) *ForStm func (n *ForStmt) String() string { return fmt.Sprint(n) } func (n *ForStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ForStmt) RawCopy() Node { c := *n; return &c } +func (n *ForStmt) rawCopy() Node { c := *n; return &c } func (n *ForStmt) Sym() *types.Sym { return n.Label } func (n *ForStmt) SetSym(x *types.Sym) { n.Label = x } func (n *ForStmt) Left() Node { return n.Cond } @@ -343,7 +343,7 @@ func NewGoStmt(pos src.XPos, call Node) *GoStmt { func (n *GoStmt) String() string { return fmt.Sprint(n) } func (n *GoStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *GoStmt) RawCopy() Node { c := *n; return &c } +func (n *GoStmt) rawCopy() Node { c := *n; return &c } func (n *GoStmt) Left() Node { return n.Call } func (n *GoStmt) SetLeft(x Node) { n.Call = x } @@ -368,7 +368,7 @@ func NewIfStmt(pos src.XPos, cond Node, body, els []Node) *IfStmt { func (n *IfStmt) String() string { return fmt.Sprint(n) } func (n *IfStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *IfStmt) RawCopy() Node { c := *n; return &c } +func (n *IfStmt) rawCopy() Node { c := *n; return &c } func (n *IfStmt) Left() Node { return n.Cond } func (n *IfStmt) SetLeft(x Node) { n.Cond = x } func (n *IfStmt) Body() Nodes { return n.body } @@ -395,7 +395,7 @@ func NewInlineMarkStmt(pos src.XPos, index int64) *InlineMarkStmt { func (n *InlineMarkStmt) String() string { return fmt.Sprint(n) } func (n *InlineMarkStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *InlineMarkStmt) RawCopy() Node { c := *n; return &c } +func (n *InlineMarkStmt) rawCopy() Node { c := *n; return &c } func (n *InlineMarkStmt) Offset() int64 { return n.Index } func (n *InlineMarkStmt) SetOffset(x int64) { n.Index = x } @@ -414,7 +414,7 @@ func NewLabelStmt(pos src.XPos, label *types.Sym) *LabelStmt { func (n *LabelStmt) String() string { return fmt.Sprint(n) } func (n *LabelStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *LabelStmt) RawCopy() Node { c := *n; return &c } +func (n *LabelStmt) rawCopy() Node { c := *n; return &c } func (n *LabelStmt) Sym() *types.Sym { return n.Label } func (n *LabelStmt) SetSym(x *types.Sym) { n.Label = x } @@ -442,7 +442,7 @@ func NewRangeStmt(pos src.XPos, vars []Node, x Node, body []Node) *RangeStmt { func (n *RangeStmt) String() string { return fmt.Sprint(n) } func (n *RangeStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *RangeStmt) RawCopy() Node { c := *n; return &c } +func (n *RangeStmt) rawCopy() Node { c := *n; return &c } func (n *RangeStmt) Sym() *types.Sym { return n.Label } func (n *RangeStmt) SetSym(x *types.Sym) { n.Label = x } func (n *RangeStmt) Right() Node { return n.X } @@ -478,7 +478,7 @@ func NewReturnStmt(pos src.XPos, results []Node) *ReturnStmt { func (n *ReturnStmt) String() string { return fmt.Sprint(n) } func (n *ReturnStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ReturnStmt) RawCopy() Node { c := *n; return &c } +func (n *ReturnStmt) rawCopy() Node { c := *n; return &c } func (n *ReturnStmt) Orig() Node { return n.orig } func (n *ReturnStmt) SetOrig(x Node) { n.orig = x } func (n *ReturnStmt) List() Nodes { return n.Results } @@ -507,7 +507,7 @@ func NewSelectStmt(pos src.XPos, cases []Node) *SelectStmt { func (n *SelectStmt) String() string { return fmt.Sprint(n) } func (n *SelectStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SelectStmt) RawCopy() Node { c := *n; return &c } +func (n *SelectStmt) rawCopy() Node { c := *n; return &c } func (n *SelectStmt) List() Nodes { return n.Cases } func (n *SelectStmt) PtrList() *Nodes { return &n.Cases } func (n *SelectStmt) SetList(x Nodes) { n.Cases = x } @@ -535,7 +535,7 @@ func NewSendStmt(pos src.XPos, ch, value Node) *SendStmt { func (n *SendStmt) String() string { return fmt.Sprint(n) } func (n *SendStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SendStmt) RawCopy() Node { c := *n; return &c } +func (n *SendStmt) rawCopy() Node { c := *n; return &c } func (n *SendStmt) Left() Node { return n.Chan } func (n *SendStmt) SetLeft(x Node) { n.Chan = x } @@ -564,7 +564,7 @@ func NewSwitchStmt(pos src.XPos, tag Node, cases []Node) *SwitchStmt { func (n *SwitchStmt) String() string { return fmt.Sprint(n) } func (n *SwitchStmt) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SwitchStmt) RawCopy() Node { c := *n; return &c } +func (n *SwitchStmt) rawCopy() Node { c := *n; return &c } func (n *SwitchStmt) Left() Node { return n.Tag } func (n *SwitchStmt) SetLeft(x Node) { n.Tag = x } func (n *SwitchStmt) List() Nodes { return n.Cases } @@ -597,7 +597,7 @@ func NewTypeSwitchGuard(pos src.XPos, name, x Node) *TypeSwitchGuard { func (n *TypeSwitchGuard) String() string { return fmt.Sprint(n) } func (n *TypeSwitchGuard) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *TypeSwitchGuard) RawCopy() Node { c := *n; return &c } +func (n *TypeSwitchGuard) rawCopy() Node { c := *n; return &c } func (n *TypeSwitchGuard) Left() Node { if n.name == nil { diff --git a/src/cmd/compile/internal/ir/type.go b/src/cmd/compile/internal/ir/type.go index 519a7291b0..af8db15e84 100644 --- a/src/cmd/compile/internal/ir/type.go +++ b/src/cmd/compile/internal/ir/type.go @@ -78,7 +78,7 @@ func NewChanType(pos src.XPos, elem Node, dir types.ChanDir) *ChanType { func (n *ChanType) String() string { return fmt.Sprint(n) } func (n *ChanType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ChanType) RawCopy() Node { c := *n; return &c } +func (n *ChanType) rawCopy() Node { c := *n; return &c } func (n *ChanType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) n.Elem = nil @@ -108,7 +108,7 @@ func NewMapType(pos src.XPos, key, elem Node) *MapType { func (n *MapType) String() string { return fmt.Sprint(n) } func (n *MapType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *MapType) RawCopy() Node { c := *n; return &c } +func (n *MapType) rawCopy() Node { c := *n; return &c } func (n *MapType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) n.Key = nil @@ -138,7 +138,7 @@ func NewStructType(pos src.XPos, fields []*Field) *StructType { func (n *StructType) String() string { return fmt.Sprint(n) } func (n *StructType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *StructType) RawCopy() Node { c := *n; return &c } +func (n *StructType) rawCopy() Node { c := *n; return &c } func (n *StructType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) n.Fields = nil @@ -175,7 +175,7 @@ func NewInterfaceType(pos src.XPos, methods []*Field) *InterfaceType { func (n *InterfaceType) String() string { return fmt.Sprint(n) } func (n *InterfaceType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *InterfaceType) RawCopy() Node { c := *n; return &c } +func (n *InterfaceType) rawCopy() Node { c := *n; return &c } func (n *InterfaceType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) n.Methods = nil @@ -206,7 +206,7 @@ func NewFuncType(pos src.XPos, rcvr *Field, args, results []*Field) *FuncType { func (n *FuncType) String() string { return fmt.Sprint(n) } func (n *FuncType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *FuncType) RawCopy() Node { c := *n; return &c } +func (n *FuncType) rawCopy() Node { c := *n; return &c } func (n *FuncType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) @@ -293,7 +293,7 @@ func NewSliceType(pos src.XPos, elem Node) *SliceType { func (n *SliceType) String() string { return fmt.Sprint(n) } func (n *SliceType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *SliceType) RawCopy() Node { c := *n; return &c } +func (n *SliceType) rawCopy() Node { c := *n; return &c } func (n *SliceType) SetOTYPE(t *types.Type) { n.setOTYPE(t, n) n.Elem = nil @@ -324,7 +324,7 @@ func NewArrayType(pos src.XPos, size Node, elem Node) *ArrayType { func (n *ArrayType) String() string { return fmt.Sprint(n) } func (n *ArrayType) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *ArrayType) RawCopy() Node { c := *n; return &c } +func (n *ArrayType) rawCopy() Node { c := *n; return &c } func (n *ArrayType) DeepCopy(pos src.XPos) Node { if n.op == OTYPE { @@ -355,7 +355,7 @@ func newTypeNode(pos src.XPos, typ *types.Type) *typeNode { func (n *typeNode) String() string { return fmt.Sprint(n) } func (n *typeNode) Format(s fmt.State, verb rune) { FmtNode(n, s, verb) } -func (n *typeNode) RawCopy() Node { c := *n; return &c } +func (n *typeNode) rawCopy() Node { c := *n; return &c } func (n *typeNode) Type() *types.Type { return n.typ } func (n *typeNode) Sym() *types.Sym { return n.typ.Sym } func (n *typeNode) CanBeNtype() {} -- 2.50.0