mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: unexport more helper functions
After the removal of the old backend many types are no longer referenced outside internal/gc. Make these functions private so that tools like honnef.co/go/unused can spot when they become dead code. In doing so this CL identified several previously public helpers which are no longer used, so removes them. This should be the last of the public functions. Change-Id: I7e9c4e72f86f391b428b9dddb6f0d516529706c3 Reviewed-on: https://go-review.googlesource.com/29134 Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
896ac677b5
commit
d7012ca282
37 changed files with 713 additions and 720 deletions
|
|
@ -119,7 +119,7 @@ func (p *noder) importDecl(imp *syntax.ImportDecl) {
|
|||
if imp.LocalPkgName != nil {
|
||||
my = p.name(imp.LocalPkgName)
|
||||
} else {
|
||||
my = Lookup(ipkg.Name)
|
||||
my = lookup(ipkg.Name)
|
||||
}
|
||||
|
||||
pack := p.nod(imp, OPACK, nil, nil)
|
||||
|
|
@ -222,7 +222,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) *Node {
|
|||
f.Nbody.Set(body)
|
||||
f.Noescape = pragma&Noescape != 0
|
||||
if f.Noescape && len(body) != 0 {
|
||||
Yyerror("can only use //go:noescape with external func implementations")
|
||||
yyerror("can only use //go:noescape with external func implementations")
|
||||
}
|
||||
f.Func.Pragma = pragma
|
||||
lineno = p.baseline + int32(fun.EndLine) - 1
|
||||
|
|
@ -243,13 +243,13 @@ func (p *noder) funcHeader(fun *syntax.FuncDecl) *Node {
|
|||
if name.Name == "init" {
|
||||
name = renameinit()
|
||||
if t.List.Len() > 0 || t.Rlist.Len() > 0 {
|
||||
Yyerror("func init must have no arguments and no return values")
|
||||
yyerror("func init must have no arguments and no return values")
|
||||
}
|
||||
}
|
||||
|
||||
if localpkg.Name == "main" && name.Name == "main" {
|
||||
if t.List.Len() > 0 || t.Rlist.Len() > 0 {
|
||||
Yyerror("func main must have no arguments and no return values")
|
||||
yyerror("func main must have no arguments and no return values")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -300,9 +300,9 @@ func (p *noder) param(param *syntax.Field, dddOk, final bool) *Node {
|
|||
// rewrite ...T parameter
|
||||
if typ.Op == ODDD {
|
||||
if !dddOk {
|
||||
Yyerror("cannot use ... in receiver or result parameter list")
|
||||
yyerror("cannot use ... in receiver or result parameter list")
|
||||
} else if !final {
|
||||
Yyerror("can only use ... with final parameter in list")
|
||||
yyerror("can only use ... with final parameter in list")
|
||||
}
|
||||
typ.Op = OTARRAY
|
||||
typ.Right = typ.Left
|
||||
|
|
@ -371,7 +371,7 @@ func (p *noder) expr(expr syntax.Expr) *Node {
|
|||
obj.Used = true
|
||||
return oldname(s)
|
||||
}
|
||||
return p.setlineno(expr, NodSym(OXDOT, obj, sel))
|
||||
return p.setlineno(expr, nodSym(OXDOT, obj, sel))
|
||||
case *syntax.IndexExpr:
|
||||
return p.nod(expr, OINDEX, p.expr(expr.X), p.expr(expr.Index))
|
||||
case *syntax.SliceExpr:
|
||||
|
|
@ -449,7 +449,7 @@ func (p *noder) expr(expr syntax.Expr) *Node {
|
|||
if expr.Lhs != nil {
|
||||
n.Left = p.declName(expr.Lhs)
|
||||
if isblank(n.Left) {
|
||||
Yyerror("invalid variable name %v in type switch", n.Left)
|
||||
yyerror("invalid variable name %v in type switch", n.Left)
|
||||
}
|
||||
}
|
||||
return n
|
||||
|
|
@ -530,7 +530,7 @@ func (p *noder) packname(expr syntax.Expr) *Sym {
|
|||
s := p.name(expr.Sel)
|
||||
var pkg *Pkg
|
||||
if name.Def == nil || name.Def.Op != OPACK {
|
||||
Yyerror("%v is not a package", name)
|
||||
yyerror("%v is not a package", name)
|
||||
pkg = localpkg
|
||||
} else {
|
||||
name.Def.Used = true
|
||||
|
|
@ -666,7 +666,7 @@ func (p *noder) stmt(stmt syntax.Stmt) *Node {
|
|||
break
|
||||
}
|
||||
if ln.Sym.Def != ln {
|
||||
Yyerror("%s is shadowed during return", ln.Sym.Name)
|
||||
yyerror("%s is shadowed during return", ln.Sym.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -948,7 +948,7 @@ func (p *noder) basicLit(lit *syntax.BasicLit) Val {
|
|||
}
|
||||
|
||||
func (p *noder) name(name *syntax.Name) *Sym {
|
||||
return Lookup(name.Value)
|
||||
return lookup(name.Value)
|
||||
}
|
||||
|
||||
func (p *noder) mkname(name *syntax.Name) *Node {
|
||||
|
|
@ -1034,7 +1034,7 @@ func (p *noder) pragma(pos, line int, text string) syntax.Pragma {
|
|||
p.error(pos, line, "usage: //go:linkname localname linkname")
|
||||
break
|
||||
}
|
||||
Lookup(f[1]).Linkname = f[2]
|
||||
lookup(f[1]).Linkname = f[2]
|
||||
|
||||
case strings.HasPrefix(text, "go:cgo_"):
|
||||
pragcgobuf += pragcgo(text)
|
||||
|
|
@ -1044,7 +1044,7 @@ func (p *noder) pragma(pos, line int, text string) syntax.Pragma {
|
|||
if i := strings.Index(text, " "); i >= 0 {
|
||||
verb = verb[:i]
|
||||
}
|
||||
return syntax.Pragma(PragmaValue(verb))
|
||||
return syntax.Pragma(pragmaValue(verb))
|
||||
}
|
||||
|
||||
return 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue