Commit 5f55011a authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/internal/gc, cmd/internal/obj: clean up string returns

An artifact of the c2go translation was
a handful of instances of code like:

var s string
s += "foo"
return s

This CL converts those to simply 'return "foo"'.

The conversion was done mechanically with the
quick-and-dirty cleanup script at
https://gist.github.com/josharian/1fa4408044c163983e62.

I then manually moved a couple of comments in fmt.go.

toolstash -cmp thinks that there are no functional changes.

Change-Id: Ic0ebdd10f0fb8de0360a1041ce5cd10ae1168be9
Reviewed-on: https://go-review.googlesource.com/6265Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent c2025c41
......@@ -170,21 +170,15 @@ var goopnames = []string{
func Oconv(o int, flag int) string {
if (flag&obj.FmtSharp != 0 /*untyped*/) || fmtmode != FDbg {
if o >= 0 && o < len(goopnames) && goopnames[o] != "" {
var fp string
fp += goopnames[o]
return fp
return goopnames[o]
}
}
if o >= 0 && o < len(opnames) && opnames[o] != "" {
var fp string
fp += opnames[o]
return fp
return opnames[o]
}
var fp string
fp += fmt.Sprintf("O-%d", o)
return fp
return fmt.Sprintf("O-%d", o)
}
var classnames = []string{
......@@ -308,9 +302,7 @@ func Vconv(v *Val, flag int) string {
switch v.Ctype {
case CTINT:
if (flag&obj.FmtSharp != 0 /*untyped*/) || fmtmode == FExp {
var fp string
fp += fmt.Sprintf("%v", Bconv(v.U.Xval, obj.FmtSharp))
return fp
return fmt.Sprintf("%v", Bconv(v.U.Xval, obj.FmtSharp))
}
var fp string
fp += fmt.Sprintf("%v", Bconv(v.U.Xval, 0))
......@@ -319,19 +311,13 @@ func Vconv(v *Val, flag int) string {
case CTRUNE:
x := Mpgetfix(v.U.Xval)
if ' ' <= x && x < 0x80 && x != '\\' && x != '\'' {
var fp string
fp += fmt.Sprintf("'%c'", int(x))
return fp
return fmt.Sprintf("'%c'", int(x))
}
if 0 <= x && x < 1<<16 {
var fp string
fp += fmt.Sprintf("'\\u%04x'", uint(int(x)))
return fp
return fmt.Sprintf("'\\u%04x'", uint(int(x)))
}
if 0 <= x && x <= utf8.MaxRune {
var fp string
fp += fmt.Sprintf("'\\U%08x'", uint64(x))
return fp
return fmt.Sprintf("'\\U%08x'", uint64(x))
}
var fp string
fp += fmt.Sprintf("('\\x00' + %v)", Bconv(v.U.Xval, 0))
......@@ -339,9 +325,7 @@ func Vconv(v *Val, flag int) string {
case CTFLT:
if (flag&obj.FmtSharp != 0 /*untyped*/) || fmtmode == FExp {
var fp string
fp += fmt.Sprintf("%v", Fconv(v.U.Fval, 0))
return fp
return fmt.Sprintf("%v", Fconv(v.U.Fval, 0))
}
var fp string
fp += fmt.Sprintf("%v", Fconv(v.U.Fval, obj.FmtSharp))
......@@ -349,24 +333,16 @@ func Vconv(v *Val, flag int) string {
case CTCPLX:
if (flag&obj.FmtSharp != 0 /*untyped*/) || fmtmode == FExp {
var fp string
fp += fmt.Sprintf("(%v+%vi)", Fconv(&v.U.Cval.Real, 0), Fconv(&v.U.Cval.Imag, 0))
return fp
return fmt.Sprintf("(%v+%vi)", Fconv(&v.U.Cval.Real, 0), Fconv(&v.U.Cval.Imag, 0))
}
if mpcmpfltc(&v.U.Cval.Real, 0) == 0 {
var fp string
fp += fmt.Sprintf("%vi", Fconv(&v.U.Cval.Imag, obj.FmtSharp))
return fp
return fmt.Sprintf("%vi", Fconv(&v.U.Cval.Imag, obj.FmtSharp))
}
if mpcmpfltc(&v.U.Cval.Imag, 0) == 0 {
var fp string
fp += fmt.Sprintf("%v", Fconv(&v.U.Cval.Real, obj.FmtSharp))
return fp
return fmt.Sprintf("%v", Fconv(&v.U.Cval.Real, obj.FmtSharp))
}
if mpcmpfltc(&v.U.Cval.Imag, 0) < 0 {
var fp string
fp += fmt.Sprintf("(%v%vi)", Fconv(&v.U.Cval.Real, obj.FmtSharp), Fconv(&v.U.Cval.Imag, obj.FmtSharp))
return fp
return fmt.Sprintf("(%v%vi)", Fconv(&v.U.Cval.Real, obj.FmtSharp), Fconv(&v.U.Cval.Imag, obj.FmtSharp))
}
var fp string
fp += fmt.Sprintf("(%v+%vi)", Fconv(&v.U.Cval.Real, obj.FmtSharp), Fconv(&v.U.Cval.Imag, obj.FmtSharp))
......@@ -379,9 +355,7 @@ func Vconv(v *Val, flag int) string {
case CTBOOL:
if v.U.Bval != 0 {
var fp string
fp += "true"
return fp
return "true"
}
var fp string
fp += "false"
......@@ -393,17 +367,13 @@ func Vconv(v *Val, flag int) string {
return fp
}
var fp string
fp += fmt.Sprintf("<ctype=%d>", v.Ctype)
return fp
return fmt.Sprintf("<ctype=%d>", v.Ctype)
}
// Fmt "%Z": escaped string literals
func Zconv(sp *Strlit, flag int) string {
if sp == nil {
var fp string
fp += "<nil>"
return fp
return "<nil>"
}
// NOTE: Keep in sync with ../ld/go.c:/^Zconv.
......@@ -491,13 +461,9 @@ var etnames = []string{
// Fmt "%E": etype
func Econv(et int, flag int) string {
if et >= 0 && et < len(etnames) && etnames[et] != "" {
var fp string
fp += etnames[et]
return fp
return etnames[et]
}
var fp string
fp += fmt.Sprintf("E-%d", et)
return fp
return fmt.Sprintf("E-%d", et)
}
// Fmt "%S": syms
......@@ -506,16 +472,12 @@ func symfmt(s *Sym, flag int) string {
switch fmtmode {
case FErr: // This is for the user
if s.Pkg == localpkg {
var fp string
fp += s.Name
return fp
return s.Name
}
// If the name was used by multiple packages, display the full path,
if s.Pkg.Name != "" && Pkglookup(s.Pkg.Name, nil).Npkg > 1 {
var fp string
fp += fmt.Sprintf("\"%v\".%s", Zconv(s.Pkg.Path, 0), s.Name)
return fp
return fmt.Sprintf("\"%v\".%s", Zconv(s.Pkg.Path, 0), s.Name)
}
var fp string
fp += fmt.Sprintf("%s.%s", s.Pkg.Name, s.Name)
......@@ -528,9 +490,7 @@ func symfmt(s *Sym, flag int) string {
case FTypeId:
if flag&obj.FmtUnsigned != 0 /*untyped*/ {
var fp string
fp += fmt.Sprintf("%s.%s", s.Pkg.Name, s.Name)
return fp // dcommontype, typehash
return fmt.Sprintf("%s.%s", s.Pkg.Name, s.Name) // dcommontype, typehash
}
var fp string
fp += fmt.Sprintf("%s.%s", s.Pkg.Prefix, s.Name)
......@@ -541,15 +501,13 @@ func symfmt(s *Sym, flag int) string {
Fatal("exporting synthetic symbol %s", s.Name)
}
if s.Pkg != builtinpkg {
var fp string
fp += fmt.Sprintf("@\"%v\".%s", Zconv(s.Pkg.Path, 0), s.Name)
return fp
return fmt.Sprintf("@\"%v\".%s", Zconv(s.Pkg.Path, 0), s.Name)
}
}
}
if flag&obj.FmtByte != 0 /*untyped*/ { // FmtByte (hh) implies FmtShort (h)
if flag&obj.FmtByte != 0 /*untyped*/ {
// FmtByte (hh) implies FmtShort (h)
// skip leading "type." in method name
p := s.Name
if i := strings.LastIndex(s.Name, "."); i >= 0 {
......@@ -558,19 +516,13 @@ func symfmt(s *Sym, flag int) string {
// exportname needs to see the name without the prefix too.
if (fmtmode == FExp && !exportname(p)) || fmtmode == FDbg {
var fp string
fp += fmt.Sprintf("@\"%v\".%s", Zconv(s.Pkg.Path, 0), p)
return fp
return fmt.Sprintf("@\"%v\".%s", Zconv(s.Pkg.Path, 0), p)
}
var fp string
fp += p
return fp
return p
}
var fp string
fp += s.Name
return fp
return s.Name
}
var basicnames = []string{
......@@ -599,25 +551,19 @@ var basicnames = []string{
func typefmt(t *Type, flag int) string {
if t == nil {
var fp string
fp += "<T>"
return fp
return "<T>"
}
if t == bytetype || t == runetype {
// in %-T mode collapse rune and byte with their originals.
if fmtmode != FTypeId {
var fp string
fp += fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtShort))
return fp
return fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtShort))
}
t = Types[t.Etype]
}
if t == errortype {
var fp string
fp += "error"
return fp
return "error"
}
// Unless the 'l' flag was specified, if the type has a name, just print that name.
......@@ -626,34 +572,24 @@ func typefmt(t *Type, flag int) string {
case FTypeId:
if flag&obj.FmtShort != 0 /*untyped*/ {
if t.Vargen != 0 {
var fp string
fp += fmt.Sprintf("%v·%d", Sconv(t.Sym, obj.FmtShort), t.Vargen)
return fp
return fmt.Sprintf("%v·%d", Sconv(t.Sym, obj.FmtShort), t.Vargen)
}
var fp string
fp += fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtShort))
return fp
return fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtShort))
}
if flag&obj.FmtUnsigned != 0 /*untyped*/ {
var fp string
fp += fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtUnsigned))
return fp
return fmt.Sprintf("%v", Sconv(t.Sym, obj.FmtUnsigned))
}
fallthrough
// fallthrough
case FExp:
if t.Sym.Pkg == localpkg && t.Vargen != 0 {
var fp string
fp += fmt.Sprintf("%v·%d", Sconv(t.Sym, 0), t.Vargen)
return fp
return fmt.Sprintf("%v·%d", Sconv(t.Sym, 0), t.Vargen)
}
}
var fp string
fp += fmt.Sprintf("%v", Sconv(t.Sym, 0))
return fp
return fmt.Sprintf("%v", Sconv(t.Sym, 0))
}
var fp string
......@@ -1228,9 +1164,7 @@ func exprfmt(n *Node, prec int) string {
}
if n == nil {
var f string
f += "<N>"
return f
return "<N>"
}
nprec := opprec[n.Op]
......@@ -1239,9 +1173,7 @@ func exprfmt(n *Node, prec int) string {
}
if prec > nprec {
var f string
f += fmt.Sprintf("(%v)", Nconv(n, 0))
return f
return fmt.Sprintf("(%v)", Nconv(n, 0))
}
switch n.Op {
......@@ -1262,26 +1194,18 @@ func exprfmt(n *Node, prec int) string {
case OLITERAL: // this is a bit of a mess
if n.Orig != nil && n.Orig != n {
var f string
f += exprfmt(n.Orig, prec)
return f
return exprfmt(n.Orig, prec)
}
if fmtmode == FErr && n.Sym != nil {
var f string
f += fmt.Sprintf("%v", Sconv(n.Sym, 0))
return f
return fmt.Sprintf("%v", Sconv(n.Sym, 0))
}
if n.Type != nil && n.Type != Types[n.Type.Etype] && n.Type != idealbool && n.Type != idealstring {
// Need parens when type begins with what might
// be misinterpreted as a unary operator: * or <-.
if Isptr[n.Type.Etype] != 0 || (n.Type.Etype == TCHAN && n.Type.Chan == Crecv) {
var f string
f += fmt.Sprintf("(%v)(%v)", Tconv(n.Type, 0), Vconv(&n.Val, 0))
return f
return fmt.Sprintf("(%v)(%v)", Tconv(n.Type, 0), Vconv(&n.Val, 0))
} else {
var f string
f += fmt.Sprintf("%v(%v)", Tconv(n.Type, 0), Vconv(&n.Val, 0))
return f
return fmt.Sprintf("%v(%v)", Tconv(n.Type, 0), Vconv(&n.Val, 0))
}
}
......@@ -1293,14 +1217,10 @@ func exprfmt(n *Node, prec int) string {
// _ becomes ~b%d internally; print as _ for export
case ONAME:
if fmtmode == FExp && n.Sym != nil && n.Sym.Name[0] == '~' && n.Sym.Name[1] == 'b' {
var f string
f += fmt.Sprintf("_")
return f
return fmt.Sprintf("_")
}
if fmtmode == FExp && n.Sym != nil && !isblank(n) && n.Vargen > 0 {
var f string
f += fmt.Sprintf("%v·%d", Sconv(n.Sym, 0), n.Vargen)
return f
return fmt.Sprintf("%v·%d", Sconv(n.Sym, 0), n.Vargen)
}
// Special case: explicit name of func (*T) method(...) is turned into pkg.(*T).method,
......@@ -1308,13 +1228,9 @@ func exprfmt(n *Node, prec int) string {
// These nodes have the special property that they are names with a left OTYPE and a right ONAME.
if fmtmode == FExp && n.Left != nil && n.Left.Op == OTYPE && n.Right != nil && n.Right.Op == ONAME {
if Isptr[n.Left.Type.Etype] != 0 {
var f string
f += fmt.Sprintf("(%v).%v", Tconv(n.Left.Type, 0), Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte))
return f
return fmt.Sprintf("(%v).%v", Tconv(n.Left.Type, 0), Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte))
} else {
var f string
f += fmt.Sprintf("%v.%v", Tconv(n.Left.Type, 0), Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte))
return f
return fmt.Sprintf("%v.%v", Tconv(n.Left.Type, 0), Sconv(n.Right.Sym, obj.FmtShort|obj.FmtByte))
}
}
fallthrough
......@@ -1328,9 +1244,7 @@ func exprfmt(n *Node, prec int) string {
case OTYPE:
if n.Type == nil && n.Sym != nil {
var f string
f += fmt.Sprintf("%v", Sconv(n.Sym, 0))
return f
return fmt.Sprintf("%v", Sconv(n.Sym, 0))
}
var f string
f += fmt.Sprintf("%v", Tconv(n.Type, 0))
......@@ -1338,9 +1252,7 @@ func exprfmt(n *Node, prec int) string {
case OTARRAY:
if n.Left != nil {
var f string
f += fmt.Sprintf("[]%v", Nconv(n.Left, 0))
return f
return fmt.Sprintf("[]%v", Nconv(n.Left, 0))
}
var f string
f += fmt.Sprintf("[]%v", Nconv(n.Right, 0))
......@@ -1365,13 +1277,9 @@ func exprfmt(n *Node, prec int) string {
default:
if n.Left != nil && n.Left.Op == OTCHAN && n.Left.Sym == nil && n.Left.Etype == Crecv {
var f string
f += fmt.Sprintf("chan (%v)", Nconv(n.Left, 0))
return f
return fmt.Sprintf("chan (%v)", Nconv(n.Left, 0))
} else {
var f string
f += fmt.Sprintf("chan %v", Nconv(n.Left, 0))
return f
return fmt.Sprintf("chan %v", Nconv(n.Left, 0))
}
}
fallthrough
......@@ -1393,14 +1301,10 @@ func exprfmt(n *Node, prec int) string {
case OCLOSURE:
if fmtmode == FErr {
var f string
f += "func literal"
return f
return "func literal"
}
if n.Nbody != nil {
var f string
f += fmt.Sprintf("%v { %v }", Tconv(n.Type, 0), Hconv(n.Nbody, 0))
return f
return fmt.Sprintf("%v { %v }", Tconv(n.Type, 0), Hconv(n.Nbody, 0))
}
var f string
f += fmt.Sprintf("%v { %v }", Tconv(n.Type, 0), Hconv(n.Closure.Nbody, 0))
......@@ -1411,26 +1315,18 @@ func exprfmt(n *Node, prec int) string {
if fmtmode == FErr {
if n.Right != nil && n.Right.Type != nil && n.Implicit == 0 {
if ptrlit {
var f string
f += fmt.Sprintf("&%v literal", Tconv(n.Right.Type.Type, 0))
return f
return fmt.Sprintf("&%v literal", Tconv(n.Right.Type.Type, 0))
} else {
var f string
f += fmt.Sprintf("%v literal", Tconv(n.Right.Type, 0))
return f
return fmt.Sprintf("%v literal", Tconv(n.Right.Type, 0))
}
}
var f string
f += "composite literal"
return f
return "composite literal"
}
if fmtmode == FExp && ptrlit {
// typecheck has overwritten OIND by OTYPE with pointer type.
var f string
f += fmt.Sprintf("(&%v{ %v })", Tconv(n.Right.Type.Type, 0), Hconv(n.List, obj.FmtComma))
return f
return fmt.Sprintf("(&%v{ %v })", Tconv(n.Right.Type.Type, 0), Hconv(n.List, obj.FmtComma))
}
var f string
......@@ -1439,9 +1335,7 @@ func exprfmt(n *Node, prec int) string {
case OPTRLIT:
if fmtmode == FExp && n.Left.Implicit != 0 {
var f string
f += fmt.Sprintf("%v", Nconv(n.Left, 0))
return f
return fmt.Sprintf("%v", Nconv(n.Left, 0))
}
var f string
f += fmt.Sprintf("&%v", Nconv(n.Left, 0))
......@@ -1479,14 +1373,10 @@ func exprfmt(n *Node, prec int) string {
case OARRAYLIT,
OMAPLIT:
if fmtmode == FErr {
var f string
f += fmt.Sprintf("%v literal", Tconv(n.Type, 0))
return f
return fmt.Sprintf("%v literal", Tconv(n.Type, 0))
}
if fmtmode == FExp && n.Implicit != 0 {
var f string
f += fmt.Sprintf("{ %v }", Hconv(n.List, obj.FmtComma))
return f
return fmt.Sprintf("{ %v }", Hconv(n.List, obj.FmtComma))
}
var f string
f += fmt.Sprintf("(%v{ %v })", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma))
......@@ -1496,25 +1386,17 @@ func exprfmt(n *Node, prec int) string {
if n.Left != nil && n.Right != nil {
if fmtmode == FExp && n.Left.Type != nil && n.Left.Type.Etype == TFIELD {
// requires special handling of field names
var f string
f += fmt.Sprintf("%v:%v", Sconv(n.Left.Sym, obj.FmtShort|obj.FmtByte), Nconv(n.Right, 0))
return f
return fmt.Sprintf("%v:%v", Sconv(n.Left.Sym, obj.FmtShort|obj.FmtByte), Nconv(n.Right, 0))
} else {
var f string
f += fmt.Sprintf("%v:%v", Nconv(n.Left, 0), Nconv(n.Right, 0))
return f
return fmt.Sprintf("%v:%v", Nconv(n.Left, 0), Nconv(n.Right, 0))
}
}
if n.Left == nil && n.Right != nil {
var f string
f += fmt.Sprintf(":%v", Nconv(n.Right, 0))
return f
return fmt.Sprintf(":%v", Nconv(n.Right, 0))
}
if n.Left != nil && n.Right == nil {
var f string
f += fmt.Sprintf("%v:", Nconv(n.Left, 0))
return f
return fmt.Sprintf("%v:", Nconv(n.Left, 0))
}
var f string
f += ":"
......@@ -1573,14 +1455,10 @@ func exprfmt(n *Node, prec int) string {
OSTRARRAYRUNE,
ORUNESTR:
if n.Type == nil || n.Type.Sym == nil {
var f string
f += fmt.Sprintf("(%v)(%v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
return f
return fmt.Sprintf("(%v)(%v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
}
if n.Left != nil {
var f string
f += fmt.Sprintf("%v(%v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
return f
return fmt.Sprintf("%v(%v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
}
var f string
f += fmt.Sprintf("%v(%v)", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma))
......@@ -1600,14 +1478,10 @@ func exprfmt(n *Node, prec int) string {
OPRINT,
OPRINTN:
if n.Left != nil {
var f string
f += fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0))
return f
return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Nconv(n.Left, 0))
}
if n.Isddd != 0 {
var f string
f += fmt.Sprintf("%v(%v...)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma))
return f
return fmt.Sprintf("%v(%v...)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma))
}
var f string
f += fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma))
......@@ -1630,19 +1504,13 @@ func exprfmt(n *Node, prec int) string {
OMAKECHAN,
OMAKESLICE:
if n.List != nil { // pre-typecheck
var f string
f += fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma))
return f
return fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Hconv(n.List, obj.FmtComma))
}
if n.Right != nil {
var f string
f += fmt.Sprintf("make(%v, %v, %v)", Tconv(n.Type, 0), Nconv(n.Left, 0), Nconv(n.Right, 0))
return f
return fmt.Sprintf("make(%v, %v, %v)", Tconv(n.Type, 0), Nconv(n.Left, 0), Nconv(n.Right, 0))
}
if n.Left != nil && (n.Op == OMAKESLICE || !isideal(n.Left.Type)) {
var f string
f += fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
return f
return fmt.Sprintf("make(%v, %v)", Tconv(n.Type, 0), Nconv(n.Left, 0))
}
var f string
f += fmt.Sprintf("make(%v)", Tconv(n.Type, 0))
......@@ -1713,9 +1581,7 @@ func exprfmt(n *Node, prec int) string {
return f
}
var f string
f += fmt.Sprintf("<node %v>", Oconv(int(n.Op), 0))
return f
return fmt.Sprintf("<node %v>", Oconv(int(n.Op), 0))
}
func nodefmt(n *Node, flag int) string {
......@@ -1730,13 +1596,9 @@ func nodefmt(n *Node, flag int) string {
if flag&obj.FmtLong != 0 /*untyped*/ && t != nil {
if t.Etype == TNIL {
var f string
f += fmt.Sprintf("nil")
return f
return fmt.Sprintf("nil")
} else {
var f string
f += fmt.Sprintf("%v (type %v)", Nconv(n, 0), Tconv(t, 0))
return f
return fmt.Sprintf("%v (type %v)", Nconv(n, 0), Tconv(t, 0))
}
}
......@@ -1746,9 +1608,7 @@ func nodefmt(n *Node, flag int) string {
return stmtfmt(n)
}
var f string
f += exprfmt(n, 0)
return f
return exprfmt(n, 0)
}
var dumpdepth int
......@@ -1872,15 +1732,11 @@ func Sconv(s *Sym, flag int) string {
}
if s == nil {
var fp string
fp += "<S>"
return fp
return "<S>"
}
if s.Name == "_" {
var fp string
fp += "_"
return fp
return "_"
}
sf := flag
......@@ -1899,15 +1755,11 @@ func Sconv(s *Sym, flag int) string {
// 'u' package name, not prefix (FTypeId mode, sticky)
func Tconv(t *Type, flag int) string {
if t == nil {
var fp string
fp += "<T>"
return fp
return "<T>"
}
if t.Trecur > 4 {
var fp string
fp += "<...>"
return fp
return "<...>"
}
t.Trecur++
......@@ -1940,9 +1792,7 @@ func Tconv(t *Type, flag int) string {
// '+h' in debug mode, don't recurse, no multiline output
func Nconv(n *Node, flag int) string {
if n == nil {
var fp string
fp += "<N>"
return fp
return "<N>"
}
sf := flag
sm := setfmode(&flag)
......@@ -1973,9 +1823,7 @@ func Nconv(n *Node, flag int) string {
// Flags: all those of %N plus ',': separate with comma's instead of semicolons.
func Hconv(l *NodeList, flag int) string {
if l == nil && fmtmode == FDbg {
var fp string
fp += "<nil>"
return fp
return "<nil>"
}
sf := flag
......
......@@ -594,9 +594,8 @@ func Bconv(xval *Mpint, flag int) string {
p--
buf[p] = '-'
}
var fp string
fp += string(buf[p:])
return fp
return string(buf[p:])
}
func Fconv(fvp *Mpflt, flag int) string {
......
......@@ -77,10 +77,7 @@ func Pconv(p *obj.Prog) string {
}
func Aconv(i int) string {
var fp string
fp += Anames[i]
return fp
return Anames[i]
}
var Register = []string{
......
......@@ -89,10 +89,7 @@ func Pconv(p *obj.Prog) string {
}
func Aconv(i int) string {
var fp string
fp += Anames[i]
return fp
return Anames[i]
}
var Register = []string{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment