gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ fmt.Printf("gmove %2v -> %2v\n", f, t)
}
ft := gc.Simsimtype(f.Type)
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthptr) {
// merge with range we already have
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ fmt.Printf("gmove %2v -> %2v\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
default:
Dump("cgen", n)
Dump("cgen-res", res)
- Fatalf("cgen: unknown op %v", Nconv(n, FmtShort|FmtSign))
+ Fatalf("cgen: unknown op %+1v", n)
case OOROR, OANDAND,
OEQ, ONE,
switch n.Op {
default:
Dump("bad agen", n)
- Fatalf("agen: unknown op %v", Nconv(n, FmtShort|FmtSign))
+ Fatalf("agen: unknown op %+1v", n)
case OCALLMETH:
cgen_callmeth(n, 0)
case OLITERAL:
// n is a constant.
if !Isconst(n, CTBOOL) {
- Fatalf("bgen: non-bool const %v\n", Nconv(n, FmtLong))
+ Fatalf("bgen: non-bool const %2v\n", n)
}
if genval {
Cgen(Nodbool(wantTrue == n.Val().U.(bool)), res)
if !n.Name.Captured {
n.Name.Captured = true
if n.Name.Decldepth == 0 {
- Fatalf("typecheckclosure: var %v does not have decldepth assigned", Nconv(n, FmtShort))
+ Fatalf("typecheckclosure: var %1v does not have decldepth assigned", n)
}
// Ignore assignments to the variable in straightline code
n.Func.Outerfunc.Func.Closgen++
gen = n.Func.Outerfunc.Func.Closgen
default:
- Fatalf("closurename called for %v", Nconv(n, FmtShort))
+ Fatalf("closurename called for %1v", n)
}
n.Sym = Lookupf("%s.%s%d", outer, prefix, gen)
return n.Sym
Yyerror("defaultlit: unknown literal: %v", n)
case CTxxx:
- Fatalf("defaultlit: idealkind is CTxxx: %v", Nconv(n, FmtSign))
+ Fatalf("defaultlit: idealkind is CTxxx: %+v", n)
case CTBOOL:
t1 := Types[TBOOL]
if Debug['m'] != 0 {
for _, n := range e.noesc {
if n.Esc == EscNone {
- Warnl(n.Lineno, "%v %v does not escape", e.curfnSym(n), Nconv(n, FmtShort))
+ Warnl(n.Lineno, "%v %1v does not escape", e.curfnSym(n), n)
}
}
}
switch n.Op {
case OLABEL:
if n.Left == nil || n.Left.Sym == nil {
- Fatalf("esc:label without label: %v", Nconv(n, FmtSign))
+ Fatalf("esc:label without label: %+v", n)
}
// Walk will complain about this label being already defined, but that's not until
case OGOTO:
if n.Left == nil || n.Left.Sym == nil {
- Fatalf("esc:goto without label: %v", Nconv(n, FmtSign))
+ Fatalf("esc:goto without label: %+v", n)
}
// If we come past one that's uninitialized, this must be a (harmless) forward jump
// b escapes as well. If we ignore such OSLICEARR, we will conclude
// that b does not escape when b contents do.
if Debug['m'] != 0 {
- Warnl(n.Lineno, "%v ignoring self-assignment to %v", e.curfnSym(n), Nconv(n.Left, FmtShort))
+ Warnl(n.Lineno, "%v ignoring self-assignment to %1v", e.curfnSym(n), n.Left)
}
break
slice2 := n.List.Second()
escassignDereference(e, &e.theSink, slice2, e.stepAssign(nil, n, slice2, "appended slice...")) // lose track of assign of dereference
if Debug['m'] > 3 {
- Warnl(n.Lineno, "%v special treatment of append(slice1, slice2...) %v", e.curfnSym(n), Nconv(n, FmtShort))
+ Warnl(n.Lineno, "%v special treatment of append(slice1, slice2...) %1v", e.curfnSym(n), n)
}
}
escassignDereference(e, &e.theSink, n.List.First(), e.stepAssign(nil, n, n.List.First(), "appendee slice")) // The original elements are now leaked, too
}
if Debug['m'] > 2 {
- fmt.Printf("%v:[%d] %v escassign: %v(%0j)[%v] = %v(%0j)[%v]\n",
+ fmt.Printf("%v:[%d] %v escassign: %1v(%0j)[%v] = %1v(%0j)[%v]\n",
linestr(lineno), e.loopdepth, funcSym(Curfn),
- Nconv(dst, FmtShort), dst, dst.Op,
- Nconv(src, FmtShort), src, src.Op)
+ dst, dst, dst.Op,
+ src, src, src.Op)
}
setlineno(dst)
}
if Debug['m'] > 3 {
- fmt.Printf("%v::assignfromtag:: src=%v, em=%s\n",
- linestr(lineno), Nconv(src, FmtShort), describeEscape(em))
+ fmt.Printf("%v::assignfromtag:: src=%1v, em=%s\n",
+ linestr(lineno), src, describeEscape(em))
}
if em == EscUnknown {
for _, n1 := range ll.Slice() {
escassignSinkNilWhy(e, n, n1, "parameter to indirect call")
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: indirect call <- %v, untracked\n", linestr(lineno), Nconv(n1, FmtShort))
+ fmt.Printf("%v::esccall:: indirect call <- %1v, untracked\n", linestr(lineno), n1)
}
}
// Set up bogus outputs
if fn != nil && fn.Op == ONAME && fn.Class == PFUNC &&
fn.Name.Defn != nil && fn.Name.Defn.Nbody.Len() != 0 && fn.Name.Param.Ntype != nil && fn.Name.Defn.Esc < EscFuncTagged {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: %v in recursive group\n", linestr(lineno), Nconv(n, FmtShort))
+ fmt.Printf("%v::esccall:: %1v in recursive group\n", linestr(lineno), n)
}
// function in same mutually recursive group. Incorporate into flow graph.
// "..." arguments are untracked
for _, n2 := range lls {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: ... <- %v, untracked\n", linestr(lineno), Nconv(n2, FmtShort))
+ fmt.Printf("%v::esccall:: ... <- %1v, untracked\n", linestr(lineno), n2)
}
escassignSinkNilWhy(e, src, n2, "... arg to recursive call")
}
// Imported or completely analyzed function. Use the escape tags.
if nE.Escretval.Len() != 0 {
- Fatalf("esc already decorated call %v\n", Nconv(n, FmtSign))
+ Fatalf("esc already decorated call %+v\n", n)
}
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: %v not recursive\n", linestr(lineno), Nconv(n, FmtShort))
+ fmt.Printf("%v::esccall:: %1v not recursive\n", linestr(lineno), n)
}
// set up out list on this call node with dummy auto ONAMES in the current (calling) function.
// Store arguments into slice for ... arg.
for ; i < len(lls); i++ {
if Debug['m'] > 3 {
- fmt.Printf("%v::esccall:: ... <- %v\n", linestr(lineno), Nconv(lls[i], FmtShort))
+ fmt.Printf("%v::esccall:: ... <- %1v\n", linestr(lineno), lls[i])
}
if note == uintptrEscapesTag {
escassignSinkNilWhy(e, src, lls[i], "arg to uintptrescapes ...")
}
if Debug['m'] > 3 {
- fmt.Printf("%v::flows:: %v <- %v\n", linestr(lineno), Nconv(dst, FmtShort), Nconv(src, FmtShort))
+ fmt.Printf("%v::flows:: %1v <- %1v\n", linestr(lineno), dst, src)
}
dstE := e.nodeEscState(dst)
dstE := e.nodeEscState(dst)
if Debug['m'] > 2 {
- fmt.Printf("\nescflood:%d: dst %v scope:%v[%d]\n", e.walkgen, Nconv(dst, FmtShort), e.curfnSym(dst), dstE.Escloopdepth)
+ fmt.Printf("\nescflood:%d: dst %1v scope:%v[%d]\n", e.walkgen, dst, e.curfnSym(dst), dstE.Escloopdepth)
}
for i, l := range dstE.Escflowsrc {
}
if Debug['m'] > 2 {
- fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %v(%0j) scope:%v[%d] extraloopdepth=%v\n",
- level, e.pdepth, e.pdepth, "\t\t\t\t\t\t\t\t\t\t", src.Op, Nconv(src, FmtShort), src, e.curfnSym(src), srcE.Escloopdepth, extraloopdepth)
+ fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %1v(%0j) scope:%v[%d] extraloopdepth=%v\n",
+ level, e.pdepth, e.pdepth, "\t\t\t\t\t\t\t\t\t\t", src.Op, src, src, e.curfnSym(src), srcE.Escloopdepth, extraloopdepth)
}
e.pdepth++
// 4. return *in
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
- Warnl(src.Lineno, "leaking param: %v to result %v level=%v", Nconv(src, FmtShort), dst.Sym, level.int())
+ Warnl(src.Lineno, "leaking param: %1v to result %v level=%v", src, dst.Sym, level.int())
step.describe(src)
} else {
- Warnl(src.Lineno, "leaking param: %v to result %v level=%v", Nconv(src, FmtShort), dst.Sym, level)
+ Warnl(src.Lineno, "leaking param: %1v to result %v level=%v", src, dst.Sym, level)
}
}
if src.Esc&EscMask != EscReturn {
level.int() > 0 {
src.Esc = escMax(EscContentEscapes|src.Esc, EscNone)
if Debug['m'] != 0 {
- Warnl(src.Lineno, "mark escaped content: %v", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "mark escaped content: %1v", src)
step.describe(src)
}
}
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
if osrcesc != src.Esc {
- Warnl(src.Lineno, "leaking param content: %v", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "leaking param content: %1v", src)
step.describe(src)
}
} else {
- Warnl(src.Lineno, "leaking param content: %v level=%v dst.eld=%v src.eld=%v dst=%v",
- Nconv(src, FmtShort), level, dstE.Escloopdepth, modSrcLoopdepth, Nconv(dst, FmtShort))
+ Warnl(src.Lineno, "leaking param content: %1v level=%v dst.eld=%v src.eld=%v dst=%1v",
+ src, level, dstE.Escloopdepth, modSrcLoopdepth, dst)
}
}
} else {
if Debug['m'] != 0 {
if Debug['m'] <= 2 {
- Warnl(src.Lineno, "leaking param: %v", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "leaking param: %1v", src)
step.describe(src)
} else {
- Warnl(src.Lineno, "leaking param: %v level=%v dst.eld=%v src.eld=%v dst=%v",
- Nconv(src, FmtShort), level, dstE.Escloopdepth, modSrcLoopdepth, Nconv(dst, FmtShort))
+ Warnl(src.Lineno, "leaking param: %1v level=%v dst.eld=%v src.eld=%v dst=%1v",
+ src, level, dstE.Escloopdepth, modSrcLoopdepth, dst)
}
}
}
// original variable.
if src.isClosureVar() {
if leaks && Debug['m'] != 0 {
- Warnl(src.Lineno, "leaking closure reference %v", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "leaking closure reference %1v", src)
step.describe(src)
}
escwalk(e, level, dst, src.Name.Defn, e.stepWalk(dst, src.Name.Defn, "closure-var", step))
p = p.Left // merely to satisfy error messages in tests
}
if Debug['m'] > 2 {
- Warnl(src.Lineno, "%v escapes to heap, level=%v, dst=%v dst.eld=%v, src.eld=%v",
- Nconv(p, FmtShort), level, dst, dstE.Escloopdepth, modSrcLoopdepth)
+ Warnl(src.Lineno, "%1v escapes to heap, level=%v, dst=%v dst.eld=%v, src.eld=%v",
+ p, level, dst, dstE.Escloopdepth, modSrcLoopdepth)
} else {
- Warnl(src.Lineno, "%v escapes to heap", Nconv(p, FmtShort))
+ Warnl(src.Lineno, "%1v escapes to heap", p)
step.describe(src)
}
}
if leaks {
src.Esc = EscHeap
if Debug['m'] != 0 && osrcesc != src.Esc {
- Warnl(src.Lineno, "%v escapes to heap", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "%1v escapes to heap", src)
step.describe(src)
}
extraloopdepth = modSrcLoopdepth
if leaks {
src.Esc = EscHeap
if Debug['m'] != 0 && osrcesc != src.Esc {
- Warnl(src.Lineno, "%v escapes to heap", Nconv(src, FmtShort))
+ Warnl(src.Lineno, "%1v escapes to heap", src)
step.describe(src)
}
extraloopdepth = modSrcLoopdepth
case OCALLMETH, OCALLFUNC, OCALLINTER:
if srcE.Escretval.Len() != 0 {
if Debug['m'] > 2 {
- fmt.Printf("%v:[%d] dst %v escwalk replace src: %v with %v\n",
+ fmt.Printf("%v:[%d] dst %1v escwalk replace src: %1v with %1v\n",
linestr(lineno), e.loopdepth,
- Nconv(dst, FmtShort), Nconv(src, FmtShort), Nconv(srcE.Escretval.First(), FmtShort))
+ dst, src, srcE.Escretval.First())
}
src = srcE.Escretval.First()
srcE = e.nodeEscState(src)
func (n *Node) Format(s fmt.State, format rune) {
switch format {
case 's', 'v':
- fmt.Fprint(s, Nconv(n, fmtFlag(s)))
+ n.Nconv(s)
case 'j':
n.jconv(s)
if n.Left != nil {
p.f("%v %v", n.Left, n.Right)
} else {
- p.Nconv(n.Right, 0)
+ p.f("%v", n.Right)
}
// Don't export "v = <N>" initializing statements, hope they're always
p.f(" %v;", n.Ninit.First())
}
if n.Left != nil {
- p.f(" %s ", Nconv(n.Left, 0))
+ p.f(" %v ", n.Left)
}
p.f(" { %v }", n.List)
if recur {
if n.Left != nil {
- p.Nconv(n.Left, 0)
+ p.f("%v", n.Left)
}
if n.Right != nil {
- p.Nconv(n.Right, 0)
+ p.f("%v", n.Right)
}
if n.List.Len() != 0 {
p.indent()
if s != nil && f.Embedded == 0 {
if f.Funarg != FunargNone {
- name = Nconv(f.Nname, 0)
+ name = f.Nname.String()
} else if flag&FmtLong != 0 {
name = fmt.Sprintf("%01v", s)
if !exportname(name) && flag&FmtUnsigned == 0 {
t.Trecur--
}
-func (n *Node) Print(p *printer) {
- p.Nconv(n, 0)
-}
-
-var _ Printable = new(Node) // verify that Node implements Printable
-
func (n *Node) String() string {
- return Nconv(n, 0)
+ return fmt.Sprint(n)
}
// Fmt '%N': Nodes.
// Flags: 'l' suffix with "(type %T)" where possible
// '+h' in debug mode, don't recurse, no multiline output
-func Nconv(n *Node, flag FmtFlag) string {
- return new(printer).Nconv(n, flag).String()
-}
+func (n *Node) Nconv(s fmt.State) {
+ flag := fmtFlag(s)
-func (p *printer) Nconv(n *Node, flag FmtFlag) *printer {
if n == nil {
- return p.s("<N>")
+ fmt.Fprint(s, "<N>")
+ return
}
+
sf := flag
sm := setfmode(&flag)
switch fmtmode {
case FErr:
- p.nodefmt(n, flag)
+ fmt.Fprint(s, new(printer).nodefmt(n, flag).String())
case FDbg:
dumpdepth++
- p.nodedump(n, flag)
+ fmt.Fprint(s, new(printer).nodedump(n, flag).String())
dumpdepth--
default:
flag = sf
fmtmode = sm
-
- return p
}
func (n Nodes) Print(p *printer) {
}
for i, n := range l.Slice() {
- p.Nconv(n, 0)
+ p.f("%v", n)
if i+1 < l.Len() {
p.s(sep)
}
}
func Dump(s string, n *Node) {
- fmt.Printf("%s [%p]%v\n", s, n, Nconv(n, FmtSign))
+ fmt.Printf("%s [%p]%+v\n", s, n, n)
}
// printer is a buffer for creating longer formatted strings.
switch n.Op {
default:
- Fatalf("gen: unknown op %v", Nconv(n, FmtShort|FmtSign))
+ Fatalf("gen: unknown op %+1v", n)
case OCASE,
OFALL,
rcvr = rcvr.Elem()
}
if rcvr.Sym == nil {
- Fatalf("receiver with no sym: [%v] %v (%v)", fn.Sym, Nconv(fn, FmtLong), rcvr)
+ Fatalf("receiver with no sym: [%v] %2v (%v)", fn.Sym, fn, rcvr)
}
return rcvr.Sym.Pkg
}
}
if Debug['m'] > 2 || Debug_export != 0 {
- fmt.Printf("typecheck import [%v] %v { %v }\n", fn.Sym, Nconv(fn, FmtLong), hconv(fn.Func.Inl, FmtSharp))
+ fmt.Printf("typecheck import [%v] %2v { %v }\n", fn.Sym, fn, hconv(fn.Func.Inl, FmtSharp))
}
save_safemode := safemode
Fatalf("caninl %v", fn)
}
if fn.Func.Nname == nil {
- Fatalf("caninl no nname %v", Nconv(fn, FmtSign))
+ Fatalf("caninl no nname %+v", fn)
}
var reason string // reason, if any, that the function was not inlined
fn.Type.SetNname(n)
if Debug['m'] > 1 {
- fmt.Printf("%v: can inline %v as: %#v { %v }\n", fn.Line(), Nconv(n, FmtSharp), fn.Type, hconv(n.Func.Inl, FmtSharp))
+ fmt.Printf("%v: can inline %#v as: %#v { %v }\n", fn.Line(), n, fn.Type, hconv(n.Func.Inl, FmtSharp))
} else if Debug['m'] != 0 {
fmt.Printf("%v: can inline %v\n", fn.Line(), n)
}
case OCALLMETH:
t := n.Left.Type
if t == nil {
- Fatalf("no function type for [%p] %v\n", n.Left, Nconv(n.Left, FmtSign))
+ Fatalf("no function type for [%p] %+v\n", n.Left, n.Left)
}
if t.Nname() == nil {
Fatalf("no function definition for [%p] %+v\n", t, t)
// statements.
func inlconv2list(n *Node) []*Node {
if n.Op != OINLCALL || n.Rlist.Len() == 0 {
- Fatalf("inlconv2list %v\n", Nconv(n, FmtSign))
+ Fatalf("inlconv2list %+v\n", n)
}
s := n.Rlist.Slice()
switch n.Op {
case OCALLFUNC:
if Debug['m'] > 3 {
- fmt.Printf("%v:call to func %v\n", n.Line(), Nconv(n.Left, FmtSign))
+ fmt.Printf("%v:call to func %+v\n", n.Line(), n.Left)
}
if n.Left.Func != nil && n.Left.Func.Inl.Len() != 0 && !isIntrinsicCall(n) { // normal case
n = mkinlcall(n, n.Left, n.Isddd)
case OCALLMETH:
if Debug['m'] > 3 {
- fmt.Printf("%v:call to meth %v\n", n.Line(), Nconv(n.Left.Right, FmtLong))
+ fmt.Printf("%v:call to meth %2v\n", n.Line(), n.Left.Right)
}
// typecheck should have resolved ODOTMETH->type, whose nname points to the actual function.
if n.Left.Type == nil {
- Fatalf("no function type for [%p] %v\n", n.Left, Nconv(n.Left, FmtSign))
+ Fatalf("no function type for [%p] %+v\n", n.Left, n.Left)
}
if n.Left.Type.Nname() == nil {
}
if Debug['m'] > 2 {
- fmt.Printf("%v: Before inlining: %v\n", n.Line(), Nconv(n, FmtSign))
+ fmt.Printf("%v: Before inlining: %+v\n", n.Line(), n)
}
ninit := n.Ninit
Fatalf("missing inlvar for %v\n", t.Nname)
}
if n.Left.Left == nil {
- Fatalf("method call without receiver: %v", Nconv(n, FmtSign))
+ Fatalf("method call without receiver: %+v", n)
}
if t == nil {
- Fatalf("method call unknown receiver type: %v", Nconv(n, FmtSign))
+ Fatalf("method call unknown receiver type: %+v", n)
}
as := Nod(OAS, tinlvar(t), n.Left.Left)
if as != nil {
if fn.Type.Recv() != nil && n.Left.Op != ODOTMETH {
// non-method call to method
if n.List.Len() == 0 {
- Fatalf("non-method call to method without first arg: %v", Nconv(n, FmtSign))
+ Fatalf("non-method call to method without first arg: %+v", n)
}
// append receiver inlvar to LHS.
Fatalf("missing inlvar for %v\n", t.Nname)
}
if t == nil {
- Fatalf("method call unknown receiver type: %v", Nconv(n, FmtSign))
+ Fatalf("method call unknown receiver type: %+v", n)
}
as.List.Append(tinlvar(t))
li++
fn.Func.Inl.Set(body)
if Debug['m'] > 2 {
- fmt.Printf("%v: After inlining %v\n\n", n.Line(), Nconv(n, FmtSign))
+ fmt.Printf("%v: After inlining %+v\n\n", n.Line(), n)
}
return n
// PPARAM's, PAUTOS and PPARAMOUTs of the called function.
func inlvar(var_ *Node) *Node {
if Debug['m'] > 3 {
- fmt.Printf("inlvar %v\n", Nconv(var_, FmtSign))
+ fmt.Printf("inlvar %+v\n", var_)
}
n := newname(var_.Sym)
case ONAME:
if n.Name.Inlvar != nil { // These will be set during inlnode
if Debug['m'] > 2 {
- fmt.Printf("substituting name %v -> %v\n", Nconv(n, FmtSign), Nconv(n.Name.Inlvar, FmtSign))
+ fmt.Printf("substituting name %+v -> %+v\n", n, n.Name.Inlvar)
}
return n.Name.Inlvar
}
if Debug['m'] > 2 {
- fmt.Printf("not substituting name %v\n", Nconv(n, FmtSign))
+ fmt.Printf("not substituting name %+v\n", n)
}
return n
m.Ninit.Set(nil)
if n.Op == OCLOSURE {
- Fatalf("cannot inline function containing closure: %v", Nconv(n, FmtSign))
+ Fatalf("cannot inline function containing closure: %+v", n)
}
m.Left = subst.node(n.Left)
if !n.Name.Needzero {
n.Name.Needzero = true
if debuglive >= 1 {
- Warnl(p.Lineno, "%v: %v is ambiguously live", Curfn.Func.Nname, Nconv(n, FmtLong))
+ Warnl(p.Lineno, "%v: %2v is ambiguously live", Curfn.Func.Nname, n)
}
// Record in 'ambiguous' bitmap.
}
n := lv.vars[j]
if n.Class != PPARAM {
- yyerrorl(p.Lineno, "internal error: %v %v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, Nconv(n, FmtLong), p.Pc)
+ yyerrorl(p.Lineno, "internal error: %v %2v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, n, p.Pc)
}
}
}
nfree := len(bystart)
for _, v := range bystart {
if debugmerge > 0 && Debug['v'] != 0 {
- fmt.Printf("consider %v: removed=%t\n", Nconv(v.node, FmtSharp), v.removed)
+ fmt.Printf("consider %#v: removed=%t\n", v.node, v.removed)
}
if v.removed {
}
if debugmerge > 0 && Debug['v'] != 0 {
- fmt.Printf("consider %v: removed=%t nfree=%d nvar=%d\n", Nconv(v.node, FmtSharp), v.removed, nfree, len(bystart))
+ fmt.Printf("consider %#v: removed=%t nfree=%d nvar=%d\n", v.node, v.removed, nfree, len(bystart))
}
// Find old temp to reuse if possible.
for j := nfree; j < len(inuse); j++ {
v1 := inuse[j]
if debugmerge > 0 && Debug['v'] != 0 {
- fmt.Printf("consider %v: maybe %v: type=%v,%v addrtaken=%v,%v\n", Nconv(v.node, FmtSharp), Nconv(v1.node, FmtSharp), t, v1.node.Type, v.node.Addrtaken, v1.node.Addrtaken)
+ fmt.Printf("consider %#v: maybe %#v: type=%v,%v addrtaken=%v,%v\n", v.node, v1.node, t, v1.node.Type, v.node.Addrtaken, v1.node.Addrtaken)
}
// Require the types to match but also require the addrtaken bits to match.
if debugmerge > 0 && Debug['v'] != 0 {
fmt.Printf("%v [%d - %d]\n", Curfn.Func.Nname.Sym, len(vars), nkill)
for _, v := range vars {
- fmt.Printf("var %v %v %d-%d", Nconv(v.node, FmtSharp), v.node.Type, v.start, v.end)
+ fmt.Printf("var %#v %v %d-%d", v.node, v.node.Type, v.start, v.end)
if v.addr {
fmt.Printf(" addr=true")
}
fmt.Printf(" removed=true")
}
if v.merge != nil {
- fmt.Printf(" merge %v", Nconv(v.merge.node, FmtSharp))
+ fmt.Printf(" merge %#v", v.merge.node)
}
if v.start == v.end && v.def != nil {
fmt.Printf(" %v", v.def.Prog)
toomany = 0
switch t.Etype {
default:
- Yyerror("cannot range over %v", Nconv(n.Right, FmtLong))
+ Yyerror("cannot range over %2v", n.Right)
goto out
case TARRAY, TSLICE:
if v1.Name != nil && v1.Name.Defn == n {
v1.Type = t1
} else if v1.Type != nil && assignop(t1, v1.Type, &why) == 0 {
- Yyerror("cannot assign type %v to %v in range%s", t1, Nconv(v1, FmtLong), why)
+ Yyerror("cannot assign type %v to %2v in range%s", t1, v1, why)
}
checkassign(n, v1)
}
if v2.Name != nil && v2.Name.Defn == n {
v2.Type = t2
} else if v2.Type != nil && assignop(t2, v2.Type, &why) == 0 {
- Yyerror("cannot assign type %v to %v in range%s", t2, Nconv(v2, FmtLong), why)
+ Yyerror("cannot assign type %v to %2v in range%s", t2, v2, why)
}
checkassign(n, v2)
}
if nvar >= NVAR {
if Debug['w'] > 1 && node != nil {
- Fatalf("variable not optimized: %v", Nconv(node, FmtSharp))
+ Fatalf("variable not optimized: %#v", node)
}
if Debug['v'] > 0 {
- Warn("variable not optimized: %v", Nconv(node, FmtSharp))
+ Warn("variable not optimized: %#v", node)
}
// If we're not tracking a word in a variable, mark the rest as
}
if Debug['R'] != 0 {
- fmt.Printf("bit=%2d et=%v w=%d+%d %v %v flag=%d\n", i, et, o, w, Nconv(node, FmtSharp), Ctxt.Dconv(a), v.addr)
+ fmt.Printf("bit=%2d et=%v w=%d+%d %#v %v flag=%d\n", i, et, o, w, node, Ctxt.Dconv(a), v.addr)
}
Ostats.Nvar++
}
if n.Op == ONAME && n.Ninit.Len() != 0 {
- Fatalf("name %v with ninit: %v\n", n.Sym, Nconv(n, FmtSign))
+ Fatalf("name %v with ninit: %+v\n", n.Sym, n)
}
init1(n, out)
var why string
op := assignop(n.Type, t, &why)
if op == 0 {
- Yyerror("cannot use %v as type %v in %s%s", Nconv(n, FmtLong), t, context(), why)
+ Yyerror("cannot use %2v as type %v in %s%s", n, t, context(), why)
op = OCONV
}
n.Left.Right = typecheck(n.Left.Right, Erv)
t = n.Left.Right.Type
if t != nil && !t.IsInterface() {
- Yyerror("cannot type switch on non-interface value %v", Nconv(n.Left.Right, FmtLong))
+ Yyerror("cannot type switch on non-interface value %2v", n.Left.Right)
}
} else {
// expression switch
if t != nil {
switch {
case !okforeq[t.Etype]:
- Yyerror("cannot switch on %v", Nconv(n.Left, FmtLong))
+ Yyerror("cannot switch on %2v", n.Left)
case t.IsSlice():
nilonly = "slice"
case t.IsArray() && !t.IsComparable():
- Yyerror("cannot switch on %v", Nconv(n.Left, FmtLong))
+ Yyerror("cannot switch on %2v", n.Left)
case t.IsStruct():
if f := t.IncomparableField(); f != nil {
- Yyerror("cannot switch on %v (struct containing %v cannot be compared)", Nconv(n.Left, FmtLong), f.Type)
+ Yyerror("cannot switch on %2v (struct containing %v cannot be compared)", n.Left, f.Type)
}
case t.Etype == TFUNC:
nilonly = "func"
case nilonly != "" && !isnil(n1):
Yyerror("invalid case %v in switch (can only compare %s %v to nil)", n1, nilonly, n.Left)
case t.IsInterface() && !n1.Type.IsInterface() && !n1.Type.IsComparable():
- Yyerror("invalid case %v in switch (incomparable type)", Nconv(n1, FmtLong))
+ Yyerror("invalid case %2v in switch (incomparable type)", n1)
}
// type switch
niltype = ncase
}
case n1.Op != OTYPE && n1.Type != nil: // should this be ||?
- Yyerror("%v is not a type", Nconv(n1, FmtLong))
+ Yyerror("%2v is not a type", n1)
// reset to original type
n1 = n.Left.Right
ls[i1] = n1
case !n1.Type.IsInterface() && t.IsInterface() && !implements(n1.Type, t, &missing, &have, &ptr):
if have != nil && !missing.Broke && !have.Broke {
- Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%1v\n\twant %v%1v", Nconv(n.Left.Right, FmtLong), n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
+ Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%1v\n\twant %v%1v", n.Left.Right, n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if !missing.Broke {
- Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (missing %v method)", Nconv(n.Left.Right, FmtLong), n1.Type, missing.Sym)
+ Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (missing %v method)", n.Left.Right, n1.Type, missing.Sym)
}
}
}
if !t.IsPtr() {
if top&(Erv|Etop) != 0 {
- Yyerror("invalid indirect of %v", Nconv(n.Left, FmtLong))
+ Yyerror("invalid indirect of %2v", n.Left)
n.Type = nil
return n
}
break OpSwitch
badcall1:
- Yyerror("invalid argument %v for %v", Nconv(n.Left, FmtLong), n.Op)
+ Yyerror("invalid argument %2v for %v", n.Left, n.Op)
n.Type = nil
return n
n.Op = convertop(t, n.Type, &why)
if n.Op == 0 {
if n.Diag == 0 && !n.Type.Broke {
- Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, FmtLong), n.Type, why)
+ Yyerror("cannot convert %2v to type %v%s", n.Left, n.Type, why)
n.Diag = 1
}
if n.Left != nil {
t := n.Left.Type
if t != nil && !t.IsBoolean() {
- Yyerror("non-bool %v used as for condition", Nconv(n.Left, FmtLong))
+ Yyerror("non-bool %2v used as for condition", n.Left)
}
}
n.Right = typecheck(n.Right, Etop)
if n.Left != nil {
t := n.Left.Type
if t != nil && !t.IsBoolean() {
- Yyerror("non-bool %v used as if condition", Nconv(n.Left, FmtLong))
+ Yyerror("non-bool %2v used as if condition", n.Left)
}
}
typecheckslice(n.Nbody.Slice(), Etop)
n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv)
} else if tt.Etype == Tptr && tt.Elem().Etype == Tptr && Eqtype(derefall(tt), derefall(rcvr)) {
- Yyerror("calling method %v with receiver %v requires explicit dereference", n.Sym, Nconv(n.Left, FmtLong))
+ Yyerror("calling method %v with receiver %2v requires explicit dereference", n.Sym, n.Left)
for tt.Etype == Tptr {
// Stop one level early for method with pointer receiver.
if rcvr.Etype == Tptr && tt.Elem().Etype != Tptr {
var why string
if assignop(src, dst.Type, &why) == 0 {
- Yyerror("cannot assign %v to %v in multiple assignment%s", src, Nconv(dst, FmtLong), why)
+ Yyerror("cannot assign %v to %2v in multiple assignment%s", src, dst, why)
return
}
}
}
if !e.Type.IsUntyped() && !Eqtype(t, e.Type) {
- Yyerror("cannot use %v as type %v in const initializer", Nconv(e, FmtLong), t)
+ Yyerror("cannot use %2v as type %v in const initializer", e, t)
goto ret
}
ORECOVER,
OGETG:
if n.Typecheck == 0 {
- Fatalf("missing typecheck: %v", Nconv(n, FmtSign))
+ Fatalf("missing typecheck: %+v", n)
}
wascopy := n.Op == OCOPY
init := n.Ninit
// the value received.
case ORECV:
if n.Typecheck == 0 {
- Fatalf("missing typecheck: %v", Nconv(n, FmtSign))
+ Fatalf("missing typecheck: %+v", n)
}
init := n.Ninit
n.Ninit.Set(nil)
}
if n.Op == ONAME {
- Fatalf("walkstmt ended up with name: %v", Nconv(n, FmtSign))
+ Fatalf("walkstmt ended up with name: %+v", n)
}
return n
}
}
if n.Typecheck != 1 {
- Fatalf("missed typecheck: %v\n", Nconv(n, FmtSign))
+ Fatalf("missed typecheck: %+v", n)
}
if n.Op == ONAME && n.Class == PAUTOHEAP {
switch n.Op {
default:
Dump("walk", n)
- Fatalf("walkexpr: switch 1 unknown op %v", Nconv(n, FmtShort|FmtSign))
+ Fatalf("walkexpr: switch 1 unknown op %+1v", n)
case OTYPE,
ONONAME,
func applywritebarrier(n *Node) *Node {
if n.Left != nil && n.Right != nil && needwritebarrier(n.Left, n.Right) {
if Debug_wb > 1 {
- Warnl(n.Lineno, "marking %v for barrier", Nconv(n.Left, 0))
+ Warnl(n.Lineno, "marking %v for barrier", n.Left)
}
n.Op = OASWB
return n
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ fmt.Printf("gmove %2v -> %2v\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
*/
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ fmt.Printf("gmove %2v -> %2v\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
// hard part is conversions.
func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 {
- fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ fmt.Printf("gmove %2v -> %2v\n", f, t)
}
ft := int(gc.Simsimtype(f.Type))
gc.Fatalf("needzero class %d", n.Class)
}
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
- gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset))
+ gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
}
if lo != hi && n.Xoffset+n.Type.Width == lo-int64(2*gc.Widthptr) {
// merge with range we already have
// should not happen
fatal:
- gc.Fatalf("gmove %v -> %v", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong))
+ gc.Fatalf("gmove %2v -> %2v", f, t)
return
}