mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/gc: delete Strlit, Zconv
Strlit was just a poor excuse for a Go string. Use a Go string. In the one case where it was a string-or-nil (Type.Note), use a *string. Zconv was a poor excuse for %q. Use %q. The only important part about Zconv's implementation was that the compiler and linker agreed on the quoting rules. Now they both use %q instead of having two Zconvs. This CL *does* change the generated object files, because the quoted strings end up in symbol names. For example the string "\r\n" used to be named go.string."\r\n" and is now go.string."\x0d\n". Change-Id: I5c0d38e1570ffc495f0db1a20273c9564104a7e8 Reviewed-on: https://go-review.googlesource.com/6519 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
4bbd7ae8e0
commit
bed1f90d08
22 changed files with 179 additions and 289 deletions
|
|
@ -443,7 +443,7 @@ func staticassign(l *Node, r *Node, out **NodeList) bool {
|
|||
case OSTRARRAYBYTE:
|
||||
if l.Class == PEXTERN && r.Left.Op == OLITERAL {
|
||||
sval := r.Left.Val.U.Sval
|
||||
slicebytes(l, sval.S, len(sval.S))
|
||||
slicebytes(l, sval, len(sval))
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -1368,7 +1368,7 @@ func iszero(n *Node) bool {
|
|||
return true
|
||||
|
||||
case CTSTR:
|
||||
return n.Val.U.Sval == nil || len(n.Val.U.Sval.S) == 0
|
||||
return n.Val.U.Sval == ""
|
||||
|
||||
case CTBOOL:
|
||||
return n.Val.U.Bval == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue