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>
// (It may be copied and assigned a type, though.)
type NilExpr struct {
miniExpr
- Sym_ *types.Sym // TODO: Remove
}
func NewNilExpr(pos src.XPos) *NilExpr {
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).
// It may end up being a value or a type.
type ParenExpr struct {
ir.AsNode(s.Def).SetType(types.Types[types.TBLANK])
s = types.BuiltinPkg.Lookup("nil")
- nnil := NodNil()
- nnil.(*ir.NilExpr).SetSym(s)
- s.Def = nnil
+ s.Def = NodNil()
// initialize okfor
for et := types.Kind(0); et < types.NTYPE; et++ {