diff options
Diffstat (limited to 'libgo/go/go/types/exprstring.go')
-rw-r--r-- | libgo/go/go/types/exprstring.go | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/libgo/go/go/types/exprstring.go b/libgo/go/go/types/exprstring.go index f05e6424d44..544cd84d612 100644 --- a/libgo/go/go/types/exprstring.go +++ b/libgo/go/go/types/exprstring.go @@ -67,16 +67,11 @@ func WriteExpr(buf *bytes.Buffer, x ast.Expr) { buf.WriteByte('.') buf.WriteString(x.Sel.Name) - case *ast.IndexExpr: - WriteExpr(buf, x.X) + case *ast.IndexExpr, *ast.IndexListExpr: + ix := typeparams.UnpackIndexExpr(x) + WriteExpr(buf, ix.X) buf.WriteByte('[') - exprs := typeparams.UnpackExpr(x.Index) - for i, e := range exprs { - if i > 0 { - buf.WriteString(", ") - } - WriteExpr(buf, e) - } + writeExprList(buf, ix.Indices) buf.WriteByte(']') case *ast.SliceExpr: @@ -145,29 +140,8 @@ func WriteExpr(buf *bytes.Buffer, x ast.Expr) { writeSigExpr(buf, x) case *ast.InterfaceType: - // separate type list types from method list - // TODO(gri) we can get rid of this extra code if writeExprList does the separation - var types []ast.Expr - var methods []*ast.Field - for _, f := range x.Methods.List { - if len(f.Names) > 1 && f.Names[0].Name == "type" { - // type list type - types = append(types, f.Type) - } else { - // method or embedded interface - methods = append(methods, f) - } - } - buf.WriteString("interface{") - writeFieldList(buf, methods, "; ", true) - if len(types) > 0 { - if len(methods) > 0 { - buf.WriteString("; ") - } - buf.WriteString("type ") - writeExprList(buf, types) - } + writeFieldList(buf, x.Methods.List, "; ", true) buf.WriteByte('}') case *ast.MapType: |