aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/staticinit
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-06-04 00:01:22 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-06-04 21:07:19 +0000
commita94e4f5a8590e7c8d3aa058fb592561d870285a9 (patch)
tree90a8c13f2226d37271f5cd6f31535f08044352e5 /src/cmd/compile/internal/staticinit
parentbad388744b57cb49f364971e21d6a2300545f0fb (diff)
downloadgo-a94e4f5a8590e7c8d3aa058fb592561d870285a9.tar.gz
go-a94e4f5a8590e7c8d3aa058fb592561d870285a9.zip
[dev.typeparams] cmd/compile: point StructKeyExpr at the types.Field
When constructing struct literals, importers need a way to specify precisely which field to initialize without worrying about visibility or those fields being blank. (A blank field doesn't actually need to be initialized, but the expression needs to be evaluated still, and with the right order-of-operations.) This CL changes StructKeyExpr's Field field to point directly to the corresponding types.Field, rather than merely holding a copy of its Sym and Offset. This is akin to past changes to add SelectorExpr.Selection. Change-Id: I95b72b1788f73206fcebc22b456cf6b1186db6a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/325031 Trust: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/staticinit')
-rw-r--r--src/cmd/compile/internal/staticinit/sched.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/staticinit/sched.go b/src/cmd/compile/internal/staticinit/sched.go
index 0c97b6de74..9329a46989 100644
--- a/src/cmd/compile/internal/staticinit/sched.go
+++ b/src/cmd/compile/internal/staticinit/sched.go
@@ -403,10 +403,10 @@ func (s *Schedule) initplan(n ir.Node) {
base.Fatalf("initplan structlit")
}
a := a.(*ir.StructKeyExpr)
- if a.Field.IsBlank() {
+ if a.Sym().IsBlank() {
continue
}
- s.addvalue(p, a.Offset, a.Value)
+ s.addvalue(p, a.Field.Offset, a.Value)
}
case ir.OMAPLIT: