From: Cuong Manh Le Date: Fri, 13 May 2022 12:04:59 +0000 (+0700) Subject: cmd/compile/internal/ir: remove NilExpr.Sym_ X-Git-Tag: go1.19beta1~248 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=80f3e3deba619fcf0ddcb547c61c9cbbd8b81968;p=gostls13.git 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 TryBot-Result: Gopher Robot Run-TryBot: Cuong Manh Le Reviewed-by: Heschi Kreinick --- diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go index ffbeb20053..43d48b4a65 100644 --- a/src/cmd/compile/internal/ir/expr.go +++ b/src/cmd/compile/internal/ir/expr.go @@ -409,7 +409,6 @@ func (n *MakeExpr) SetOp(op Op) { // (It may be copied and assigned a type, though.) type NilExpr struct { miniExpr - Sym_ *types.Sym // TODO: Remove } func NewNilExpr(pos src.XPos) *NilExpr { @@ -419,9 +418,6 @@ 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 { diff --git a/src/cmd/compile/internal/typecheck/universe.go b/src/cmd/compile/internal/typecheck/universe.go index a49bf5793e..19cb244d58 100644 --- a/src/cmd/compile/internal/typecheck/universe.go +++ b/src/cmd/compile/internal/typecheck/universe.go @@ -101,9 +101,7 @@ func InitUniverse() { 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++ {