]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ir: remove NilExpr.Sym_
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 13 May 2022 12:04:59 +0000 (19:04 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 13 May 2022 21:28:16 +0000 (21:28 +0000)
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>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/typecheck/universe.go

index ffbeb20053f9baf991a08984dda2592e078e0388..43d48b4a65a91f8dfe84a2e58245442ac14c95f8 100644 (file)
@@ -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 {
index a49bf5793e85ae64db1d0d3e9d9a20e48d8b185f..19cb244d58eb0bcd6ae128a3e49b4eff7eb61ebe 100644 (file)
@@ -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++ {