cmd/compile: implement fmt.Formatter for *Type formats %s, %v

Change-Id: I878ac549430abc7859c30d176d52d52ce02c5827
Reviewed-on: https://go-review.googlesource.com/28333
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2016-08-31 10:32:40 -07:00
parent 97ba3c8242
commit 8d0bbe2b48
22 changed files with 167 additions and 137 deletions

View file

@ -75,7 +75,7 @@ func widstruct(errtype *Type, t *Type, o int64, flag int) int64 {
}
o += w
if o >= Thearch.MAXWIDTH {
Yyerror("type %v too large", Tconv(errtype, FmtLong))
Yyerror("type %2v too large", errtype)
o = 8 // small but nonzero
}
}
@ -253,7 +253,7 @@ func dowidth(t *Type) {
if t.Elem().Width != 0 {
cap := (uint64(Thearch.MAXWIDTH) - 1) / uint64(t.Elem().Width)
if uint64(t.NumElem()) > cap {
Yyerror("type %v larger than address space", Tconv(t, FmtLong))
Yyerror("type %2v larger than address space", t)
}
}
w = t.NumElem() * t.Elem().Width