diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2022-06-21 07:56:25 -0700 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2022-06-23 21:54:51 +0000 |
| commit | 46b01ec667c05fb8eb8f382b173e126282acd80c (patch) | |
| tree | 51579f6fe2765fe89b978cede1ea84410059f782 /src/cmd/compile/internal/noder | |
| parent | a3e474f86746924022c92f66bfb465f7ad6ea8a5 (diff) | |
| download | go-46b01ec667c05fb8eb8f382b173e126282acd80c.tar.xz | |
[dev.unified] cmd/compile/internal/noder: remove needType logic
This logic is a holdover from very early on when it wasn't as clear
how we would handle dictionary entries for derived types, particularly
ones that are emitted during desugaring.
However, the current plan is to explicitly wire runtime type info
through IR nodes, so we can drop this logic.
Notably, the "needed" bit is exposed to the go/types importers, so
removing it would break the x/tools importer. To minimize churn for
now, we can just leave the bools in place.
Change-Id: I374927887d4f3d6d711d3355607849a407d717c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/413367
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/noder')
| -rw-r--r-- | src/cmd/compile/internal/noder/writer.go | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go index e2d2aba072..e773b8973d 100644 --- a/src/cmd/compile/internal/noder/writer.go +++ b/src/cmd/compile/internal/noder/writer.go @@ -179,7 +179,7 @@ type writerDict struct { // A derivedInfo represents a reference to an encoded generic Go type. type derivedInfo struct { idx pkgbits.Index - needed bool + needed bool // TODO(mdempsky): Remove; will break x/tools importer } // A typeInfo represents a reference to an encoded Go type. @@ -1362,13 +1362,6 @@ func (w *writer) expr(expr syntax.Expr) { targs := inst.TypeArgs if tv, ok := w.p.info.Types[expr]; ok { - // TODO(mdempsky): Be more judicious about which types are marked as "needed". - if inst.Type != nil { - w.needType(inst.Type) - } else { - w.needType(tv.Type) - } - if tv.IsType() { w.p.fatalf(expr, "unexpected type expression %v", syntax.String(expr)) } @@ -1714,20 +1707,6 @@ func (w *writer) op(op ir.Op) { w.Len(int(op)) } -func (w *writer) needType(typ types2.Type) { - // Decompose tuple into component element types. - if typ, ok := typ.(*types2.Tuple); ok { - for i := 0; i < typ.Len(); i++ { - w.needType(typ.At(i).Type()) - } - return - } - - if info := w.p.typIdx(typ, w.dict); info.derived { - w.dict.derived[info.idx].needed = true - } -} - // @@@ Package initialization // Caution: This code is still clumsy, because toolstash -cmp is |
