mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: remove all uses of oconv(op, FmtSharp)
Updates #15462 Replace all use of oconv(op, FmtSharp) with fmt.Printf("%#v", op). This removes all the callers of oconv. Change-Id: Ic3bf22495147f8497c8bada01d681428e2405b0e Reviewed-on: https://go-review.googlesource.com/22530 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f08f1cd2e9
commit
733f835f30
4 changed files with 23 additions and 22 deletions
|
|
@ -192,7 +192,14 @@ var goopnames = []string{
|
||||||
OXFALL: "fallthrough",
|
OXFALL: "fallthrough",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fmt "%O": Node opcodes
|
func (o Op) String() string {
|
||||||
|
return oconv(o, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o Op) GoString() string {
|
||||||
|
return oconv(o, FmtSharp)
|
||||||
|
}
|
||||||
|
|
||||||
func oconv(o Op, flag FmtFlag) string {
|
func oconv(o Op, flag FmtFlag) string {
|
||||||
if (flag&FmtSharp != 0) || fmtmode != FDbg {
|
if (flag&FmtSharp != 0) || fmtmode != FDbg {
|
||||||
if o >= 0 && int(o) < len(goopnames) && goopnames[o] != "" {
|
if o >= 0 && int(o) < len(goopnames) && goopnames[o] != "" {
|
||||||
|
|
@ -453,10 +460,6 @@ func (e EType) String() string {
|
||||||
return Econv(e)
|
return Econv(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o Op) String() string {
|
|
||||||
return oconv(o, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fmt "%S": syms
|
// Fmt "%S": syms
|
||||||
func symfmt(s *Sym, flag FmtFlag) string {
|
func symfmt(s *Sym, flag FmtFlag) string {
|
||||||
if s.Pkg != nil && flag&FmtShort == 0 {
|
if s.Pkg != nil && flag&FmtShort == 0 {
|
||||||
|
|
@ -840,7 +843,7 @@ func stmtfmt(n *Node) string {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
f += fmt.Sprintf("%v %v= %v", n.Left, oconv(Op(n.Etype), FmtSharp), n.Right)
|
f += fmt.Sprintf("%v %#v= %v", n.Left, Op(n.Etype), n.Right)
|
||||||
|
|
||||||
case OAS2:
|
case OAS2:
|
||||||
if n.Colas && !complexinit {
|
if n.Colas && !complexinit {
|
||||||
|
|
@ -918,7 +921,7 @@ func stmtfmt(n *Node) string {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
f += oconv(n.Op, FmtSharp)
|
f += n.Op.GoString() // %#v
|
||||||
if simpleinit {
|
if simpleinit {
|
||||||
f += fmt.Sprintf(" %v;", n.Ninit.First())
|
f += fmt.Sprintf(" %v;", n.Ninit.First())
|
||||||
}
|
}
|
||||||
|
|
@ -941,9 +944,9 @@ func stmtfmt(n *Node) string {
|
||||||
OFALL,
|
OFALL,
|
||||||
OXFALL:
|
OXFALL:
|
||||||
if n.Left != nil {
|
if n.Left != nil {
|
||||||
f += fmt.Sprintf("%v %v", oconv(n.Op, FmtSharp), n.Left)
|
f += fmt.Sprintf("%#v %v", n.Op, n.Left)
|
||||||
} else {
|
} else {
|
||||||
f += oconv(n.Op, FmtSharp)
|
f += n.Op.GoString() // %#v
|
||||||
}
|
}
|
||||||
|
|
||||||
case OEMPTY:
|
case OEMPTY:
|
||||||
|
|
@ -1337,7 +1340,7 @@ func exprfmt(n *Node, prec int) string {
|
||||||
return buf.String()
|
return buf.String()
|
||||||
|
|
||||||
case OCOPY, OCOMPLEX:
|
case OCOPY, OCOMPLEX:
|
||||||
return fmt.Sprintf("%v(%v, %v)", oconv(n.Op, FmtSharp), n.Left, n.Right)
|
return fmt.Sprintf("%#v(%v, %v)", n.Op, n.Left, n.Right)
|
||||||
|
|
||||||
case OCONV,
|
case OCONV,
|
||||||
OCONVIFACE,
|
OCONVIFACE,
|
||||||
|
|
@ -1369,12 +1372,12 @@ func exprfmt(n *Node, prec int) string {
|
||||||
OPRINT,
|
OPRINT,
|
||||||
OPRINTN:
|
OPRINTN:
|
||||||
if n.Left != nil {
|
if n.Left != nil {
|
||||||
return fmt.Sprintf("%v(%v)", oconv(n.Op, FmtSharp), n.Left)
|
return fmt.Sprintf("%#v(%v)", n.Op, n.Left)
|
||||||
}
|
}
|
||||||
if n.Isddd {
|
if n.Isddd {
|
||||||
return fmt.Sprintf("%v(%v...)", oconv(n.Op, FmtSharp), Hconv(n.List, FmtComma))
|
return fmt.Sprintf("%#v(%v...)", n.Op, Hconv(n.List, FmtComma))
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%v(%v)", oconv(n.Op, FmtSharp), Hconv(n.List, FmtComma))
|
return fmt.Sprintf("%#v(%v)", n.Op, Hconv(n.List, FmtComma))
|
||||||
|
|
||||||
case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, OGETG:
|
case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, OGETG:
|
||||||
var f string
|
var f string
|
||||||
|
|
@ -1406,11 +1409,9 @@ func exprfmt(n *Node, prec int) string {
|
||||||
OIND,
|
OIND,
|
||||||
ONOT,
|
ONOT,
|
||||||
ORECV:
|
ORECV:
|
||||||
var f string
|
f := n.Op.GoString() // %#v
|
||||||
if n.Left.Op == n.Op {
|
if n.Left.Op == n.Op {
|
||||||
f += fmt.Sprintf("%v ", oconv(n.Op, FmtSharp))
|
f += " "
|
||||||
} else {
|
|
||||||
f += oconv(n.Op, FmtSharp)
|
|
||||||
}
|
}
|
||||||
f += exprfmt(n.Left, nprec+1)
|
f += exprfmt(n.Left, nprec+1)
|
||||||
return f
|
return f
|
||||||
|
|
@ -1439,7 +1440,7 @@ func exprfmt(n *Node, prec int) string {
|
||||||
var f string
|
var f string
|
||||||
f += exprfmt(n.Left, nprec)
|
f += exprfmt(n.Left, nprec)
|
||||||
|
|
||||||
f += fmt.Sprintf(" %v ", oconv(n.Op, FmtSharp))
|
f += fmt.Sprintf(" %#v ", n.Op)
|
||||||
f += exprfmt(n.Right, nprec+1)
|
f += exprfmt(n.Right, nprec+1)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
@ -1460,7 +1461,7 @@ func exprfmt(n *Node, prec int) string {
|
||||||
var f string
|
var f string
|
||||||
f += exprfmt(n.Left, nprec)
|
f += exprfmt(n.Left, nprec)
|
||||||
// TODO(marvin): Fix Node.EType type union.
|
// TODO(marvin): Fix Node.EType type union.
|
||||||
f += fmt.Sprintf(" %v ", oconv(Op(n.Etype), FmtSharp))
|
f += fmt.Sprintf(" %#v ", Op(n.Etype))
|
||||||
f += exprfmt(n.Right, nprec+1)
|
f += exprfmt(n.Right, nprec+1)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ func gvardefx(n *Node, as obj.As) {
|
||||||
Fatalf("gvardef nil")
|
Fatalf("gvardef nil")
|
||||||
}
|
}
|
||||||
if n.Op != ONAME {
|
if n.Op != ONAME {
|
||||||
Yyerror("gvardef %v; %v", oconv(n.Op, FmtSharp), n)
|
Yyerror("gvardef %#v; %v", n.Op, n)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ func unsafenmagic(nn *Node) *Node {
|
||||||
v += r1.Xoffset
|
v += r1.Xoffset
|
||||||
default:
|
default:
|
||||||
Dump("unsafenmagic", r)
|
Dump("unsafenmagic", r)
|
||||||
Fatalf("impossible %v node after dot insertion", oconv(r1.Op, FmtSharp))
|
Fatalf("impossible %#v node after dot insertion", r1.Op)
|
||||||
goto bad
|
goto bad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2285,7 +2285,7 @@ func reorder3(all []*Node) []*Node {
|
||||||
|
|
||||||
switch l.Op {
|
switch l.Op {
|
||||||
default:
|
default:
|
||||||
Fatalf("reorder3 unexpected lvalue %v", oconv(l.Op, FmtSharp))
|
Fatalf("reorder3 unexpected lvalue %#v", l.Op)
|
||||||
|
|
||||||
case ONAME:
|
case ONAME:
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue