Commit 3de8498b authored by Daniel Martí's avatar Daniel Martí Committed by Matthew Dempsky

cmd/compile: remove some unused params in gc

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: 's avatarMatthew Dempsky <mdempsky@google.com>
parent e085a891
......@@ -292,7 +292,7 @@ func genhash(sym *types.Sym, t *types.Type) {
dumplist("genhash body", fn.Nbody)
}
funcbody(fn)
funcbody()
Curfn = fn
fn.Func.SetDupok(true)
fn = typecheck(fn, Etop)
......@@ -476,7 +476,7 @@ func geneq(sym *types.Sym, t *types.Type) {
dumplist("geneq body", fn.Nbody)
}
funcbody(fn)
funcbody()
Curfn = fn
fn.Func.SetDupok(true)
fn = typecheck(fn, Etop)
......
......@@ -200,7 +200,7 @@ func Import(imp *types.Pkg, in *bufio.Reader) {
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
......
......@@ -19,7 +19,7 @@ func (p *noder) funcLit(expr *syntax.FuncLit) *Node {
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.
......@@ -60,7 +60,7 @@ func (p *noder) funcLit(expr *syntax.FuncLit) *Node {
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.
......
......@@ -519,7 +519,7 @@ func funcstart(n *Node) {
// 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)
......
......@@ -198,7 +198,7 @@ func fninit(n []*Node) {
exportsym(fn.Func.Nname)
fn.Nbody.Set(r)
funcbody(fn)
funcbody()
Curfn = fn
fn = typecheck(fn, Etop)
......
......@@ -78,15 +78,15 @@ type noder struct {
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
}
......@@ -382,9 +382,8 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
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")
......@@ -396,7 +395,6 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
}
f.Nbody.Set(body)
endPos = fun.Body.Rbrace
lineno = Ctxt.PosTable.XPos(fun.Body.Rbrace)
f.Func.Endlineno = lineno
} else {
......@@ -405,7 +403,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
}
}
p.funcbody(f, endPos, oldScope)
p.funcbody(oldScope)
return f
}
......
......@@ -1765,7 +1765,7 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym, iface
dumplist("genwrapper body", fn.Nbody)
}
funcbody(fn)
funcbody()
Curfn = fn
types.Popdcl()
if debug_dclstack != 0 {
......
......@@ -1096,11 +1096,9 @@ OpSwitch:
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
......@@ -1123,7 +1121,7 @@ OpSwitch:
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
......
......@@ -762,7 +762,7 @@ opswitch:
}
init.Append(r)
ll := ascompatet(n.Op, n.List, r.Type)
ll := ascompatet(n.List, r.Type)
n = liststmt(ll)
// x, y = <-c
......@@ -1699,7 +1699,7 @@ func reduceSlice(n *Node) *Node {
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)
......@@ -1734,7 +1734,7 @@ func ascompatee(op Op, nl, nr []*Node, init *Nodes) []*Node {
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
......@@ -1767,7 +1767,7 @@ func fncall(l *Node, rt *types.Type) bool {
// 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())
}
......@@ -3853,7 +3853,7 @@ func walkprintfunc(n *Node, init *Nodes) *Node {
fn.Nbody.Set1(a)
funcbody(fn)
funcbody()
fn = typecheck(fn, Etop)
typecheckslice(fn.Nbody.Slice(), Etop)
......
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