aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/expr.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-03-23 10:19:11 -0700
committerDan Scales <danscales@google.com>2021-03-25 00:06:23 +0000
commite7e0995cba1f57622f593ebd27d4d1a651666c4b (patch)
treee6be1b5449112b3a8a117901a4b8b160d9d5fa55 /src/cmd/compile/internal/typecheck/expr.go
parent29ed12d4c7e61f6b4cc38d5b3d5eb885294f7878 (diff)
downloadgo-e7e0995cba1f57622f593ebd27d4d1a651666c4b.tar.gz
go-e7e0995cba1f57622f593ebd27d4d1a651666c4b.zip
cmd/compile: create/use noder2 transform functions for more node types
Pull out the transformation part of the typechecking functions for: - assignment statements - return statements - send statements - select statements - type conversions - normal function/method calls - index operations The transform functions are like the original typechecking functions, but with all code removed related to: - Detecting compile-time errors (already done by types2) - Setting the actual type of existing nodes (already done based on info from types2) - Dealing with untyped constants Moved all the transformation functions to a separate file, transform.go. Continuing with the same pattern, we delay transforming a node if it has any type params in its args, marking it with a typecheck flag of 3, and do the actual transformation during stenciling. Assignment statements are tricky, since their transformation must be delayed if any of the left or right-hands-sides are delayed. Still to do are: - selector expressions (OXDOT) - composite literal expressions (OCOMPLIT) - builtin function calls Change-Id: Ie608cadbbc69b40db0067a5536cf707dd974aacc Reviewed-on: https://go-review.googlesource.com/c/go/+/304049 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/expr.go')
-rw-r--r--src/cmd/compile/internal/typecheck/expr.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go
index fb39709686..7ab1670a45 100644
--- a/src/cmd/compile/internal/typecheck/expr.go
+++ b/src/cmd/compile/internal/typecheck/expr.go
@@ -419,7 +419,7 @@ func tcConv(n *ir.ConvExpr) ir.Node {
n.SetType(nil)
return n
}
- op, why := convertop(n.X.Op() == ir.OLITERAL, t, n.Type())
+ op, why := Convertop(n.X.Op() == ir.OLITERAL, t, n.Type())
if op == ir.OXXX {
if !n.Diag() && !n.Type().Broke() && !n.X.Diag() {
base.Errorf("cannot convert %L to type %v%s", n.X, n.Type(), why)