]> Cypherpunks repositories - gostls13.git/commit
[dev.regabi] cmd/compile: use []*CaseStmt in {Select,Switch}Stmt
authorMatthew Dempsky <mdempsky@google.com>
Sun, 27 Dec 2020 06:23:45 +0000 (22:23 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 28 Dec 2020 07:45:09 +0000 (07:45 +0000)
commita59d26603f0dffbe6e914bc9ab29a2f9f70e5408
treeb3d8bccf6f264b2dff1d9ae7ff8a4bc9ae28885f
parentfbc4458c068459940c63952bcc6a697728f508fc
[dev.regabi] cmd/compile: use []*CaseStmt in {Select,Switch}Stmt

Select and switch statements only ever contain case statements, so
change their Cases fields from Nodes to []*CaseStmt. This allows
removing a bunch of type assertions throughout the compiler.

CaseStmt should be renamed to CaseClause, and SelectStmt should
probably have its own CommClause type instead (like in go/ast and
cmd/compile/internal/syntax), but this is a good start.

Passes toolstash -cmp.

Change-Id: I2d41d616d44512c2be421e1e2ff13d0ee8b238ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/280442
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
13 files changed:
src/cmd/compile/internal/escape/escape.go
src/cmd/compile/internal/ir/mknode.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/stmt.go
src/cmd/compile/internal/ir/visit.go
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
src/cmd/compile/internal/typecheck/stmt.go
src/cmd/compile/internal/typecheck/typecheck.go
src/cmd/compile/internal/walk/order.go
src/cmd/compile/internal/walk/select.go
src/cmd/compile/internal/walk/switch.go