Passes toolstash -cmp.
Change-Id: I2c71882f957c44047c7ac83c78236dcc3dfa15a1
Reviewed-on: https://go-review.googlesource.com/21304
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
default:
// LCHAN hidden_type_non_recv_chan
s2 := p.hidden_type_non_recv_chan()
- ss := typ(TCHAN)
- ss.Type = s2
- ss.Chan = Cboth
+ ss := typeChan(s2, Cboth)
return ss
case '(':
p.next()
s3 := p.hidden_type_recv_chan()
p.want(')')
- ss := typ(TCHAN)
- ss.Type = s3
- ss.Chan = Cboth
+ ss := typeChan(s3, Cboth)
return ss
case LCOMM:
// LCHAN hidden_type
p.next()
s3 := p.hidden_type()
- ss := typ(TCHAN)
- ss.Type = s3
- ss.Chan = Csend
+ ss := typeChan(s3, Csend)
return ss
}
p.want(LCHAN)
s3 := p.hidden_type()
- ss := typ(TCHAN)
- ss.Type = s3
- ss.Chan = Crecv
+ ss := typeChan(s3, Crecv)
return ss
}
return t
}
+// typeChan returns a new chan Type with direction dir.
+func typeChan(elem *Type, dir uint8) *Type {
+ t := typ(TCHAN)
+ t.Type = elem
+ t.Chan = dir
+ return t
+}
+
func newField() *Field {
return &Field{
Offset: BADWIDTH,
n.Type = nil
return n
}
- t := typ(TCHAN)
- t.Type = l.Type
- // TODO(marvin): Fix Node.EType type union.
- t.Chan = uint8(n.Etype)
+ t := typeChan(l.Type, uint8(n.Etype)) // TODO(marvin): Fix Node.EType type union.
n.Op = OTYPE
n.Type = t
n.Left = nil