mirror of
https://github.com/golang/go.git
synced 2025-11-01 17:20:56 +00:00
[dev.regabi] cmd/compile: add NewNamed
The start of abstracting away Type fields. This adds a new constructor for named types, styled after go/types.NewNamed. Along with helper methods for SetNod and Pos, this allows hiding Nod. Change-Id: Ica107034b6346c7b523bf6ae2a34009e350a9aa8 Reviewed-on: https://go-review.googlesource.com/c/go/+/274434 Trust: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
63a6f08b39
commit
f37aa5e4e2
11 changed files with 75 additions and 63 deletions
|
|
@ -545,9 +545,7 @@ func (*ParenExpr) CanBeNtype() {}
|
|||
func (n *ParenExpr) SetOTYPE(t *types.Type) {
|
||||
n.op = OTYPE
|
||||
n.typ = t
|
||||
if t.Nod == nil {
|
||||
t.Nod = n
|
||||
}
|
||||
t.SetNod(n)
|
||||
}
|
||||
|
||||
// A ResultExpr represents a direct access to a result slot on the stack frame.
|
||||
|
|
@ -762,9 +760,7 @@ func (n *StarExpr) SetOTYPE(t *types.Type) {
|
|||
n.op = OTYPE
|
||||
n.X = nil
|
||||
n.typ = t
|
||||
if t.Nod == nil {
|
||||
t.Nod = n
|
||||
}
|
||||
t.SetNod(n)
|
||||
}
|
||||
|
||||
func (n *StarExpr) DeepCopy(pos src.XPos) Node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue