Commit 048c766e authored by Robert Griesemer's avatar Robert Griesemer

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: 's avatarMatthew Dempsky <mdempsky@google.com>
parent ae37f5a3
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment