Automated refactoring using gofmt.
Passes toolstash-check.
Change-Id: I8624e1c231dc736e1bb4cc800acaf629a0af91d7
Reviewed-on: https://go-review.googlesource.com/38740
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
tfn := nod(OTFUNC, nil, nil)
fn.Func.Nname.Name.Param.Ntype = tfn
- n := nod(ODCLFIELD, newname(lookup("p")), typenod(typPtr(t)))
+ n := namedfield("p", typPtr(t))
tfn.List.Append(n)
np := n.Left
- n = nod(ODCLFIELD, newname(lookup("h")), typenod(Types[TUINTPTR]))
+ n = namedfield("h", Types[TUINTPTR])
tfn.List.Append(n)
nh := n.Left
- n = nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])) // return value
+ n = anonfield(Types[TUINTPTR]) // return value
tfn.Rlist.Append(n)
funchdr(fn)
n := newname(sym)
n.Class = PFUNC
tfn := nod(OTFUNC, nil, nil)
- tfn.List.Append(nod(ODCLFIELD, nil, typenod(typPtr(t))))
- tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
- tfn.Rlist.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
+ tfn.List.Append(anonfield(typPtr(t)))
+ tfn.List.Append(anonfield(Types[TUINTPTR]))
+ tfn.Rlist.Append(anonfield(Types[TUINTPTR]))
tfn = typecheck(tfn, Etype)
n.Type = tfn.Type
return n
tfn := nod(OTFUNC, nil, nil)
fn.Func.Nname.Name.Param.Ntype = tfn
- n := nod(ODCLFIELD, newname(lookup("p")), typenod(typPtr(t)))
+ n := namedfield("p", typPtr(t))
tfn.List.Append(n)
np := n.Left
- n = nod(ODCLFIELD, newname(lookup("q")), typenod(typPtr(t)))
+ n = namedfield("q", typPtr(t))
tfn.List.Append(n)
nq := n.Left
- n = nod(ODCLFIELD, nil, typenod(Types[TBOOL]))
+ n = anonfield(Types[TBOOL])
tfn.Rlist.Append(n)
funchdr(fn)
typ := nod(OTSTRUCT, nil, nil)
- typ.List.Set1(nod(ODCLFIELD, newname(lookup(".F")), typenod(Types[TUINTPTR])))
+ typ.List.Set1(namedfield(".F", Types[TUINTPTR]))
for _, v := range func_.Func.Cvars.Slice() {
if v.Op == OXXX {
continue
}
typ := nod(OTSTRUCT, nil, nil)
- typ.List.Set1(nod(ODCLFIELD, newname(lookup("F")), typenod(Types[TUINTPTR])))
- typ.List.Append(nod(ODCLFIELD, newname(lookup("R")), typenod(n.Left.Type)))
+ typ.List.Set1(namedfield("F", Types[TUINTPTR]))
+ typ.List.Append(namedfield("R", n.Left.Type))
clos := nod(OCOMPLIT, nil, nod(OIND, typ, nil))
clos.Esc = n.Esc
if thisT == nil {
thisT = typPtr(typ(TSTRUCT))
}
- return nod(ODCLFIELD, nil, typenod(thisT))
+ return anonfield(thisT)
}
func fakethisfield() *Field {
// The latter is the type of an auto-generated wrapper.
dtypesym(typPtr(errortype))
- dtypesym(functype(nil, []*Node{nod(ODCLFIELD, nil, typenod(errortype))}, []*Node{nod(ODCLFIELD, nil, typenod(Types[TSTRING]))}))
+ dtypesym(functype(nil, []*Node{anonfield(errortype)}, []*Node{anonfield(Types[TSTRING])}))
// add paths for runtime and main, which 6l imports implicitly.
dimportpath(Runtimepkg)
// and then cache; and also cache Select per size.
scase := nod(OTSTRUCT, nil, nil)
- scase.List.Append(nod(ODCLFIELD, newname(lookup("elem")), typenod(typPtr(Types[TUINT8]))))
- scase.List.Append(nod(ODCLFIELD, newname(lookup("chan")), typenod(typPtr(Types[TUINT8]))))
- scase.List.Append(nod(ODCLFIELD, newname(lookup("pc")), typenod(Types[TUINTPTR])))
- scase.List.Append(nod(ODCLFIELD, newname(lookup("kind")), typenod(Types[TUINT16])))
- scase.List.Append(nod(ODCLFIELD, newname(lookup("receivedp")), typenod(typPtr(Types[TUINT8]))))
- scase.List.Append(nod(ODCLFIELD, newname(lookup("releasetime")), typenod(Types[TUINT64])))
+ scase.List.Append(namedfield("elem", typPtr(Types[TUINT8])))
+ scase.List.Append(namedfield("chan", typPtr(Types[TUINT8])))
+ scase.List.Append(namedfield("pc", Types[TUINTPTR]))
+ scase.List.Append(namedfield("kind", Types[TUINT16]))
+ scase.List.Append(namedfield("receivedp", typPtr(Types[TUINT8])))
+ scase.List.Append(namedfield("releasetime", Types[TUINT64]))
scase = typecheck(scase, Etype)
scase.Type.SetNoalg(true)
scase.Type.SetLocal(true)
sel := nod(OTSTRUCT, nil, nil)
- sel.List.Append(nod(ODCLFIELD, newname(lookup("tcase")), typenod(Types[TUINT16])))
- sel.List.Append(nod(ODCLFIELD, newname(lookup("ncase")), typenod(Types[TUINT16])))
- sel.List.Append(nod(ODCLFIELD, newname(lookup("pollorder")), typenod(typPtr(Types[TUINT8]))))
- sel.List.Append(nod(ODCLFIELD, newname(lookup("lockorder")), typenod(typPtr(Types[TUINT8]))))
+ sel.List.Append(namedfield("tcase", Types[TUINT16]))
+ sel.List.Append(namedfield("ncase", Types[TUINT16]))
+ sel.List.Append(namedfield("pollorder", typPtr(Types[TUINT8])))
+ sel.List.Append(namedfield("lockorder", typPtr(Types[TUINT8])))
arr := nod(OTARRAY, nodintconst(int64(size)), scase)
sel.List.Append(nod(ODCLFIELD, newname(lookup("scase")), arr))
arr = nod(OTARRAY, nodintconst(int64(size)), typenod(Types[TUINT16]))
dclcontext = PEXTERN
markdcl()
- this := nod(ODCLFIELD, newname(lookup(".this")), typenod(rcvr))
+ this := namedfield(".this", rcvr)
this.Left.Name.Param.Ntype = this.Right
in := structargs(method.Type.Params(), true)
out := structargs(method.Type.Results(), false)
// Add a dummy padding argument after the
// receiver to make up the difference.
tpad := typArray(Types[TUINT8], int64(Widthptr)-rcvr.Width)
- pad := nod(ODCLFIELD, newname(lookup(".pad")), typenod(tpad))
+ pad := namedfield(".pad", tpad)
l = append(l, pad)
}
n := newname(sym)
n.Class = PFUNC
tfn := nod(OTFUNC, nil, nil)
- tfn.List.Append(nod(ODCLFIELD, nil, typenod(typPtr(t))))
- tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
- tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
- tfn.Rlist.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
+ tfn.List.Append(anonfield(typPtr(t)))
+ tfn.List.Append(anonfield(Types[TUINTPTR]))
+ tfn.List.Append(anonfield(Types[TUINTPTR]))
+ tfn.Rlist.Append(anonfield(Types[TUINTPTR]))
tfn = typecheck(tfn, Etype)
n.Type = tfn.Type
return n
n := newname(sym)
n.Class = PFUNC
ntype := nod(OTFUNC, nil, nil)
- ntype.List.Append(nod(ODCLFIELD, nil, typenod(typPtr(t))))
- ntype.List.Append(nod(ODCLFIELD, nil, typenod(typPtr(t))))
- ntype.Rlist.Append(nod(ODCLFIELD, nil, typenod(Types[TBOOL])))
+ ntype.List.Append(anonfield(typPtr(t)))
+ ntype.List.Append(anonfield(typPtr(t)))
+ ntype.Rlist.Append(anonfield(Types[TBOOL]))
ntype = typecheck(ntype, Etype)
n.Type = ntype.Type
*needsize = 0
for _, n1 := range n.List.Slice() {
buf = fmt.Sprintf("a%d", num)
num++
- a = nod(ODCLFIELD, newname(lookup(buf)), typenod(n1.Type))
+ a = namedfield(buf, n1.Type)
t.List.Append(a)
printargs = append(printargs, a.Left)
}