From e7e0995cba1f57622f593ebd27d4d1a651666c4b Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Tue, 23 Mar 2021 10:19:11 -0700 Subject: 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 TryBot-Result: Go Bot Trust: Dan Scales Trust: Robert Griesemer Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/typecheck/expr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/compile/internal/typecheck/expr.go') 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) -- cgit v1.2.3-54-g00ecf