cmd/compile: give ChanDir a type

Change-Id: I03621db79637b04982e1f0e7b4268c4ed2db6d22
Reviewed-on: https://go-review.googlesource.com/21484
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-04-03 22:58:10 +00:00
parent 73edd7b208
commit 386c0e6598
8 changed files with 27 additions and 21 deletions

View file

@ -1154,7 +1154,7 @@ func exprfmt(n *Node, prec int) string {
return fmt.Sprintf("map[%v]%v", n.Left, n.Right)
case OTCHAN:
switch n.Etype {
switch ChanDir(n.Etype) {
case Crecv:
return fmt.Sprintf("<-chan %v", n.Left)
@ -1162,7 +1162,7 @@ func exprfmt(n *Node, prec int) string {
return fmt.Sprintf("chan<- %v", n.Left)
default:
if n.Left != nil && n.Left.Op == OTCHAN && n.Left.Sym == nil && n.Left.Etype == Crecv {
if n.Left != nil && n.Left.Op == OTCHAN && n.Left.Sym == nil && ChanDir(n.Left.Etype) == Crecv {
return fmt.Sprintf("chan (%v)", n.Left)
} else {
return fmt.Sprintf("chan %v", n.Left)