cmd/compile: abstract type type+value obtained from types2

In preparation for encoding it in a more efficient way.

Change-Id: I299dd2befc3d07107a1b7b49225bbb9f2e48a343
Reviewed-on: https://go-review.googlesource.com/c/go/+/432896
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Keith Randall 2022-09-02 13:50:10 -07:00
parent dcb90152a4
commit b52783c1e9
4 changed files with 52 additions and 50 deletions

View file

@ -390,3 +390,19 @@ func (g *irgen) unhandled(what string, p poser) {
func (g *irgen) delayTransform() bool {
return g.topFuncIsGeneric
}
func (g *irgen) typeAndValue(x syntax.Expr) types2.TypeAndValue {
tv, ok := g.info.Types[x]
if !ok {
base.FatalfAt(g.pos(x), "missing type for %v (%T)", x, x)
}
return tv
}
func (g *irgen) type2(x syntax.Expr) types2.Type {
tv, ok := g.info.Types[x]
if !ok {
base.FatalfAt(g.pos(x), "missing type for %v (%T)", x, x)
}
return tv.Type
}