]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: clean up the switch statements in (*genInst).node()
authorDan Scales <danscales@google.com>
Tue, 19 Oct 2021 01:11:48 +0000 (18:11 -0700)
committerDan Scales <danscales@google.com>
Tue, 26 Oct 2021 20:08:41 +0000 (20:08 +0000)
commitb54bdd281e62a4658ea4edb5e0a6139006938c9a
tree6df6aac4c21491e7a3cf036b6d314a24ab38acf5
parent1dc77a38d293763b9de50110dd72edd755ce72b7
cmd/compile: clean up the switch statements in (*genInst).node()

There were two main outer switch statements in node() that can just be
combined. Also, for simplicity, changed an IsCmp() conditional into just
another case in the switch statement.

Also, the inner OCALL switch statement had a bunch of fairly duplicate
cases. Combined the cases that all had no special semantics, into a
single default case calling transformCall().

In the OCALL case in dictPass(), got rid of a check for OFUNCINST (which
will always have been removed by this point). Also, eliminated an assert
that could cause unneded failures. transformCall() should always be
called if the node op is still OCALL, so no need to assert on the ops of
call.X.

Added an extra test in issue47078.go, to explicitly check for case where
the X argument of a call is a DOTTYPE.

Change-Id: Ifb3f812ce12820a4ce08afe2887f00f7fc00cd2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/358596
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue47878.go