mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: stop storing TFIELD types in Node.Type
Currently, the only use for this is on the Left side of OKEY nodes within struct literals. esc and fmt only care so they can recognize that the ONAME nodes are actually field names, which need special handling. sinit additionally needs to know the field's offset within the struct, which we can provide via Xoffset. Passes toolstash/buildall. Change-Id: I362d965e161f4d80fcd9c9bae0dfacc657dc0b29 Reviewed-on: https://go-review.googlesource.com/20676 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9bffcf382b
commit
c278f9302e
5 changed files with 23 additions and 6 deletions
|
|
@ -1287,7 +1287,7 @@ func exprfmt(n *Node, prec int) string {
|
|||
|
||||
case OKEY:
|
||||
if n.Left != nil && n.Right != nil {
|
||||
if fmtmode == FExp && n.Left.Type != nil && n.Left.Type.Etype == TFIELD {
|
||||
if fmtmode == FExp && n.Left.Type == structkey {
|
||||
// requires special handling of field names
|
||||
return fmt.Sprintf("%v:%v", Sconv(n.Left.Sym, obj.FmtShort|obj.FmtByte), n.Right)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue