提交 1365d395 编写于 作者: chai2010's avatar chai2010

清理部分 chan 有关代码

上级 c74e609e
......@@ -818,29 +818,6 @@ func (p *parser) parseMapType() *ast.MapType {
return &ast.MapType{pos, key, value}
}
func (p *parser) parseChanType() *ast.ChanType {
if p.trace {
defer un(trace(p, "ChanType"))
}
pos := p.pos
dir := ast.SEND | ast.RECV
if p.tok == token.CHAN {
p.next()
if p.tok == token.ARROW {
p.next()
dir = ast.SEND
}
} else {
p.expect(token.ARROW)
p.expect(token.CHAN)
dir = ast.RECV
}
value := p.parseType()
return &ast.ChanType{pos, dir, value}
}
// If the result is an identifier, it is not resolved.
func (p *parser) tryIdentOrType(ellipsisOk bool) ast.Expr {
switch p.tok {
......@@ -859,8 +836,6 @@ func (p *parser) tryIdentOrType(ellipsisOk bool) ast.Expr {
return p.parseInterfaceType()
case token.MAP:
return p.parseMapType()
case token.CHAN, token.ARROW:
return p.parseChanType()
case token.LPAREN:
lparen := p.pos
p.next()
......
......@@ -436,7 +436,7 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
case opElem:
hasElem, ok := t.(hasElem) // Pointer, Slice, Array, Map
if !ok {
return nil, fmt.Errorf("cannot apply %q to %s (got %T, want pointer, slice, array, chan or map)", code, t, t)
return nil, fmt.Errorf("cannot apply %q to %s (got %T, want pointer, slice, array or map)", code, t, t)
}
t = hasElem.Elem()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册