aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/expr.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2022-09-02 13:50:10 -0700
committerKeith Randall <khr@golang.org>2022-09-27 17:08:05 +0000
commitb52783c1e9673793da85dc7a9fb433d033da2e10 (patch)
tree3332667c7414b0cbb530ddba7769eda31d55bb24 /src/cmd/compile/internal/noder/expr.go
parentdcb90152a444be97fcc45bb12d176641c1b0d90e (diff)
downloadgo-b52783c1e9673793da85dc7a9fb433d033da2e10.tar.xz
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>
Diffstat (limited to 'src/cmd/compile/internal/noder/expr.go')
-rw-r--r--src/cmd/compile/internal/noder/expr.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/noder/expr.go b/src/cmd/compile/internal/noder/expr.go
index 54b07c39f4..f391339c36 100644
--- a/src/cmd/compile/internal/noder/expr.go
+++ b/src/cmd/compile/internal/noder/expr.go
@@ -27,10 +27,7 @@ func (g *irgen) expr(expr syntax.Expr) ir.Node {
return ir.BlankNode
}
- tv, ok := g.info.Types[expr]
- if !ok {
- base.FatalfAt(g.pos(expr), "missing type for %v (%T)", expr, expr)
- }
+ tv := g.typeAndValue(expr)
switch {
case tv.IsBuiltin():
// Qualified builtins, such as unsafe.Add and unsafe.Slice.
@@ -105,8 +102,7 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
case *syntax.IndexExpr:
args := unpackListExpr(expr.Index)
if len(args) == 1 {
- tv, ok := g.info.Types[args[0]]
- assert(ok)
+ tv := g.typeAndValue(args[0])
if tv.IsValue() {
// This is just a normal index expression
n := Index(pos, g.typ(typ), g.expr(expr.X), g.expr(args[0]))