]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: avoid ir.DeepCopy in noder.constDecl
authorMatthew Dempsky <mdempsky@google.com>
Sat, 12 Jun 2021 01:51:56 +0000 (18:51 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 12 Jun 2021 13:53:06 +0000 (13:53 +0000)
commit8f00eb009978e2e1bb681e698a0b51e20333eb05
tree956d34b1655aec665621de5fa1c0c4a61e02be54
parent2954f11eadf344786d0ec6e3e1d34f6a5c385246
[dev.typeparams] cmd/compile: avoid ir.DeepCopy in noder.constDecl

Instead of using ir.DeepCopy to copy the IR from the previous constant
declaration, just call exprList again and then fix up the position
information. This is equivalent in practice, but has cleaner semantics
for tricky corner cases like constant declarations that contain
function literals.

In particular, this refactoring is necessary for the next CL that
cleans up function literal construction, because it adds extra
consistency checks that weren't satisfied by DeepCopy'd OCLOSUREs.

Change-Id: I0372bde5d6613695ee572cc8bf8fb4ff9aef4cb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/327449
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>
src/cmd/compile/internal/noder/noder.go