aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/noder.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-11-29 09:38:52 -0500
committerRuss Cox <rsc@golang.org>2020-11-30 18:34:07 +0000
commitd40869fcedb208b0bcf7e7d828db12f210a17dc6 (patch)
treee7ad82d42dc864458cf041ec5a268105c6fa2bdf /src/cmd/compile/internal/gc/noder.go
parentf0001e8867be0004a8bc13eaea8b59653a5d141e (diff)
downloadgo-d40869fcedb208b0bcf7e7d828db12f210a17dc6.tar.xz
[dev.regabi] cmd/compile: move gc.treecopy to ir.DeepCopy
This is a general operation on IR nodes, so it belongs in ir. The copied implementation is adapted to support the extension pattern, allowing nodes to implement their own DeepCopy implementations if needed. This is the first step toward higher-level operations instead of Left, Right, etc. It will allow the new type syntax nodes to be properly immutable and opt out of those fine-grained methods. Passes buildall w/ toolstash -cmp. Change-Id: Ibd64061e01daf14aebc6586cb2eb2b12057ca85a Reviewed-on: https://go-review.googlesource.com/c/go/+/274102 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/noder.go')
-rw-r--r--src/cmd/compile/internal/gc/noder.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go
index 8ae5874d3b..1c433b5d30 100644
--- a/src/cmd/compile/internal/gc/noder.go
+++ b/src/cmd/compile/internal/gc/noder.go
@@ -451,7 +451,7 @@ func (p *noder) constDecl(decl *syntax.ConstDecl, cs *constState) []ir.Node {
}
v := values[i]
if decl.Values == nil {
- v = treecopy(v, n.Pos())
+ v = ir.DeepCopy(n.Pos(), v)
}
n.SetOp(ir.OLITERAL)