Let ast.TypeExpr represent method types

This commit is contained in:
Nigel Tao committed 2017-12-09 13:55:59 +11:00
1 parent 2e12a41414
commit bf00d114e4
4 files changed
+77 -24

No files matched your search

+5
View File
@@ -202,6 +202,11 @@ func (n *TypeExpr) appendStr(buf []byte, tm *t.Map, depth uint32) []byte {
case t.KeyColon:
buf = append(buf, "[] "...)
return n.Inner().appendStr(buf, tm, depth)
case t.KeyOpenParen:
buf = append(buf, "func "...)
buf = n.Receiver().appendStr(buf, tm, depth)
buf = append(buf, '.')
return append(buf, tm.ByID(n.Name())...)
default:
buf = append(buf, tm.ByID(n.Decorator())...)
buf = append(buf, '.')