mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: minor code reorg (cleanup)
Found while tracking down #26855. Change-Id: Ice137fe390820ba351e1c7439b6a9a1b3bdc966b Reviewed-on: https://go-review.googlesource.com/136396 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
ae37f5a397
commit
048c766e66
1 changed files with 3 additions and 5 deletions
|
|
@ -1304,16 +1304,14 @@ func (n *Node) exprfmt(s fmt.State, prec int, mode fmtMode) {
|
|||
mode.Fprintf(s, "%v { %v }", n.Type, n.Func.Closure.Nbody)
|
||||
|
||||
case OCOMPLIT:
|
||||
ptrlit := n.Right != nil && n.Right.Implicit() && n.Right.Type != nil && n.Right.Type.IsPtr()
|
||||
if mode == FErr {
|
||||
if n.Right != nil && n.Right.Type != nil && !n.Implicit() {
|
||||
if ptrlit {
|
||||
if n.Right.Implicit() && n.Right.Type.IsPtr() {
|
||||
mode.Fprintf(s, "&%v literal", n.Right.Type.Elem())
|
||||
return
|
||||
} else {
|
||||
mode.Fprintf(s, "%v literal", n.Right.Type)
|
||||
return
|
||||
}
|
||||
mode.Fprintf(s, "%v literal", n.Right.Type)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprint(s, "composite literal")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue