diff options
author | Matthew Dempsky <mdempsky@google.com> | 2022-05-03 12:58:54 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2022-05-05 18:49:04 +0000 |
commit | cf66a82b0bc8fd8925db8ba7d90df67d21feaf55 (patch) | |
tree | 097c3bf2538c45ae96988a03805a9ea1d4525bc4 /src/cmd/compile/internal/ir/expr.go | |
parent | 3abe8fe00bdc9ae35b54c36e5e73632346051315 (diff) | |
download | go-git-cf66a82b0bc8fd8925db8ba7d90df67d21feaf55.tar.gz |
cmd/compile/internal/ir: prune down possible Ntype nodes
Ident, ParenExpr, SelectorExpr, and StarExpr used to need to be
allowed as Ntypes for the old -G=0 type checker to represent some type
expressions before type checking, but now they're only ever used to
represent value expressions.
Change-Id: Idd4901ae6149ecc81acf1c52de3bc914d9e73418
Reviewed-on: https://go-review.googlesource.com/c/go/+/403844
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ir/expr.go')
-rw-r--r-- | src/cmd/compile/internal/ir/expr.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go index 986fb29e45..ffbeb20053 100644 --- a/src/cmd/compile/internal/ir/expr.go +++ b/src/cmd/compile/internal/ir/expr.go @@ -439,16 +439,6 @@ func NewParenExpr(pos src.XPos, x Node) *ParenExpr { func (n *ParenExpr) Implicit() bool { return n.flags&miniExprImplicit != 0 } func (n *ParenExpr) SetImplicit(b bool) { n.flags.set(miniExprImplicit, b) } -func (*ParenExpr) CanBeNtype() {} - -// SetOTYPE changes n to be an OTYPE node returning t, -// like all the type nodes in type.go. -func (n *ParenExpr) SetOTYPE(t *types.Type) { - n.op = OTYPE - n.typ = t - t.SetNod(n) -} - // A RawOrigExpr represents an arbitrary Go expression as a string value. // When printed in diagnostics, the string value is written out exactly as-is. type RawOrigExpr struct { @@ -558,10 +548,6 @@ func (n *SelectorExpr) FuncName() *Name { return fn } -// Before type-checking, bytes.Buffer is a SelectorExpr. -// After type-checking it becomes a Name. -func (*SelectorExpr) CanBeNtype() {} - // A SliceExpr is a slice expression X[Low:High] or X[Low:High:Max]. type SliceExpr struct { miniExpr @@ -633,17 +619,6 @@ func NewStarExpr(pos src.XPos, x Node) *StarExpr { func (n *StarExpr) Implicit() bool { return n.flags&miniExprImplicit != 0 } func (n *StarExpr) SetImplicit(b bool) { n.flags.set(miniExprImplicit, b) } -func (*StarExpr) CanBeNtype() {} - -// SetOTYPE changes n to be an OTYPE node returning t, -// like all the type nodes in type.go. -func (n *StarExpr) SetOTYPE(t *types.Type) { - n.op = OTYPE - n.X = nil - n.typ = t - t.SetNod(n) -} - // A TypeAssertionExpr is a selector expression X.(Type). // Before type-checking, the type is Ntype. type TypeAssertExpr struct { |