Mostly node and position parameters that are no longer used.
Also remove an unnecessary node variable while at it.
Found with github.com/mvdan/unparam.
Change-Id: I88f9bd5d20bfc5b0f6f63ea81869daa246175061
Reviewed-on: https://go-review.googlesource.com/54130
Run-TryBot: Daniel Martà <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
dumplist("genhash body", fn.Nbody)
}
- funcbody(fn)
+ funcbody()
Curfn = fn
fn.Func.SetDupok(true)
fn = typecheck(fn, Etop)
dumplist("geneq body", fn.Nbody)
}
- funcbody(fn)
+ funcbody()
Curfn = fn
fn.Func.SetDupok(true)
fn = typecheck(fn, Etop)
body = []*Node{nod(OEMPTY, nil, nil)}
}
f.Func.Inl.Set(body)
- funcbody(f)
+ funcbody()
} else {
// function already imported - read body but discard declarations
dclcontext = PDISCARD // throw away any declarations
n.Func.Depth = funcdepth
n.Func.Outerfunc = Curfn
- old := p.funchdr(n, expr.Pos())
+ old := p.funchdr(n)
// steal ntype's argument names and
// leave a fresh copy in their place.
n.Nbody.Set(body)
n.Func.Endlineno = lineno
- p.funcbody(n, expr.Body.Rbrace, old)
+ p.funcbody(old)
// closure-specific variables are hanging off the
// ordinary ones in the symbol table; see oldname.
// finish the body.
// called in auto-declaration context.
// returns in extern-declaration context.
-func funcbody(n *Node) {
+func funcbody() {
// change the declaration context from auto to extern
if dclcontext != PAUTO {
Fatalf("funcbody: unexpected dclcontext %d", dclcontext)
exportsym(fn.Func.Nname)
fn.Nbody.Set(r)
- funcbody(fn)
+ funcbody()
Curfn = fn
fn = typecheck(fn, Etop)
scope ScopeID
}
-func (p *noder) funchdr(n *Node, pos src.Pos) ScopeID {
+func (p *noder) funchdr(n *Node) ScopeID {
old := p.scope
p.scope = 0
funchdr(n)
return old
}
-func (p *noder) funcbody(n *Node, pos src.Pos, old ScopeID) {
- funcbody(n)
+func (p *noder) funcbody(old ScopeID) {
+ funcbody()
p.scope = old
}
declare(f.Func.Nname, PFUNC)
}
- oldScope := p.funchdr(f, fun.Pos())
+ oldScope := p.funchdr(f)
- endPos := fun.Pos()
if fun.Body != nil {
if f.Noescape() {
yyerrorl(f.Pos, "can only use //go:noescape with external func implementations")
}
f.Nbody.Set(body)
- endPos = fun.Body.Rbrace
lineno = Ctxt.PosTable.XPos(fun.Body.Rbrace)
f.Func.Endlineno = lineno
} else {
}
}
- p.funcbody(f, endPos, oldScope)
+ p.funcbody(oldScope)
return f
}
dumplist("genwrapper body", fn.Nbody)
}
- funcbody(fn)
+ funcbody()
Curfn = fn
types.Popdcl()
if debug_dclstack != 0 {
case OSEND:
ok |= Etop
n.Left = typecheck(n.Left, Erv)
- l := n.Left
n.Right = typecheck(n.Right, Erv)
n.Left = defaultlit(n.Left, nil)
- l = n.Left
- t := l.Type
+ t := n.Left.Type
if t == nil {
n.Type = nil
return n
n.Type = nil
return n
}
- n.Right = assignconv(r, l.Type.Elem(), "send")
+ n.Right = assignconv(r, t.Elem(), "send")
// TODO: more aggressive
n.Etype = 0
}
init.Append(r)
- ll := ascompatet(n.Op, n.List, r.Type)
+ ll := ascompatet(n.List, r.Type)
n = liststmt(ll)
// x, y = <-c
return n
}
-func ascompatee1(op Op, l *Node, r *Node, init *Nodes) *Node {
+func ascompatee1(l *Node, r *Node, init *Nodes) *Node {
// convas will turn map assigns into function calls,
// making it impossible for reorder3 to work.
n := nod(OAS, l, r)
if op == ORETURN && samesafeexpr(nl[i], nr[i]) {
continue
}
- nn = append(nn, ascompatee1(op, nl[i], nr[i], init))
+ nn = append(nn, ascompatee1(nl[i], nr[i], init))
}
// cannot happen: caller checked that lists had same length
// check assign type list to
// a expression list. called in
// expr-list = func()
-func ascompatet(op Op, nl Nodes, nr *types.Type) []*Node {
+func ascompatet(nl Nodes, nr *types.Type) []*Node {
if nl.Len() != nr.NumFields() {
Fatalf("ascompatet: assignment count mismatch: %d = %d", nl.Len(), nr.NumFields())
}
fn.Nbody.Set1(a)
- funcbody(fn)
+ funcbody()
fn = typecheck(fn, Etop)
typecheckslice(fn.Nbody.Slice(), Etop)