mirror of
https://github.com/golang/go
synced 2024-11-17 14:44:44 -07:00
cmd/compile/internal/ir: remove NilExpr.Sym_
Historically, the compiler used to use a name node to represent "nil". Now, "nil" is represented by NilExpr, so it's not necessary to associate a Sym with it anymore. Passes toolstash-check. Change-Id: Ied1ddefa06ea55ada18ca52c8fcf71defa4c23b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/406174 Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
499e334a28
commit
80f3e3deba
@ -409,7 +409,6 @@ func (n *MakeExpr) SetOp(op Op) {
|
|||||||
// (It may be copied and assigned a type, though.)
|
// (It may be copied and assigned a type, though.)
|
||||||
type NilExpr struct {
|
type NilExpr struct {
|
||||||
miniExpr
|
miniExpr
|
||||||
Sym_ *types.Sym // TODO: Remove
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNilExpr(pos src.XPos) *NilExpr {
|
func NewNilExpr(pos src.XPos) *NilExpr {
|
||||||
@ -419,9 +418,6 @@ func NewNilExpr(pos src.XPos) *NilExpr {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NilExpr) Sym() *types.Sym { return n.Sym_ }
|
|
||||||
func (n *NilExpr) SetSym(x *types.Sym) { n.Sym_ = x }
|
|
||||||
|
|
||||||
// A ParenExpr is a parenthesized expression (X).
|
// A ParenExpr is a parenthesized expression (X).
|
||||||
// It may end up being a value or a type.
|
// It may end up being a value or a type.
|
||||||
type ParenExpr struct {
|
type ParenExpr struct {
|
||||||
|
@ -101,9 +101,7 @@ func InitUniverse() {
|
|||||||
ir.AsNode(s.Def).SetType(types.Types[types.TBLANK])
|
ir.AsNode(s.Def).SetType(types.Types[types.TBLANK])
|
||||||
|
|
||||||
s = types.BuiltinPkg.Lookup("nil")
|
s = types.BuiltinPkg.Lookup("nil")
|
||||||
nnil := NodNil()
|
s.Def = NodNil()
|
||||||
nnil.(*ir.NilExpr).SetSym(s)
|
|
||||||
s.Def = nnil
|
|
||||||
|
|
||||||
// initialize okfor
|
// initialize okfor
|
||||||
for et := types.Kind(0); et < types.NTYPE; et++ {
|
for et := types.Kind(0); et < types.NTYPE; et++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user