Skip to content

Commit

Permalink
cmd/compile/internal/gc: minor code reorg (cleanup)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
griesemer committed Sep 20, 2018
1 parent ae37f5a commit 048c766
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cmd/compile/internal/gc/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 048c766

Please sign in to comment.