mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: inline typedcl0 and typedcl1
It's easier to understand what's happening after inlining these into noder.typeDecl. Change-Id: I7beed5a1e18047bf09f2d4ddf64b9646c324d8d6 Reviewed-on: https://go-review.googlesource.com/36111 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
bb41b4d599
commit
a27b78141b
3 changed files with 19 additions and 34 deletions
|
|
@ -263,12 +263,25 @@ func (p *noder) constDecl(decl *syntax.ConstDecl, cs *constState) []*Node {
|
|||
}
|
||||
|
||||
func (p *noder) typeDecl(decl *syntax.TypeDecl) *Node {
|
||||
name := typedcl0(p.name(decl.Name))
|
||||
n := p.declName(decl.Name)
|
||||
n.Op = OTYPE
|
||||
declare(n, dclcontext)
|
||||
n.Local = true
|
||||
|
||||
// decl.Type may be nil but in that case we got a syntax error during parsing
|
||||
typ := p.typeExprOrNil(decl.Type)
|
||||
|
||||
return typedcl1(name, typ, syntax.Pragma(decl.Pragma), decl.Alias)
|
||||
param := n.Name.Param
|
||||
param.Ntype = typ
|
||||
param.Pragma = decl.Pragma
|
||||
param.Alias = decl.Alias
|
||||
if param.Alias && param.Pragma != 0 {
|
||||
yyerror("cannot specify directive with type alias")
|
||||
param.Pragma = 0
|
||||
}
|
||||
|
||||
return p.nod(decl, ODCLTYPE, n, nil)
|
||||
|
||||
}
|
||||
|
||||
func (p *noder) declNames(names []*syntax.Name) []*Node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue