aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iexport.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-26 22:42:17 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-28 08:01:27 +0000
commit2ecf52b841cd48e76df1fe721d29a972c22bf93f (patch)
treee0987204c1c40aebfb04538ff0e26399e9090255 /src/cmd/compile/internal/typecheck/iexport.go
parented9772e130d81b3a5a7b9e9b58e8d48a5ec4c319 (diff)
downloadgo-2ecf52b841cd48e76df1fe721d29a972c22bf93f.tar.gz
go-2ecf52b841cd48e76df1fe721d29a972c22bf93f.zip
[dev.regabi] cmd/compile: separate CommStmt from CaseStmt
Like go/ast and cmd/compile/internal/syntax before it, package ir now has separate concrete representations for switch-case clauses and select-communication clauses. Passes toolstash -cmp. Change-Id: I32667cbae251fe7881be0f434388478433b2414f Reviewed-on: https://go-review.googlesource.com/c/go/+/280443 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>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iexport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 19437a069e..ef2c4527a9 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -1144,7 +1144,7 @@ func (w *exportWriter) stmt(n ir.Node) {
w.op(n.Op())
w.pos(n.Pos())
w.stmtList(n.Init())
- w.caseList(n.Cases, false)
+ w.commList(n.Cases)
case ir.OSWITCH:
n := n.(*ir.SwitchStmt)
@@ -1193,6 +1193,15 @@ func (w *exportWriter) caseList(cases []*ir.CaseStmt, namedTypeSwitch bool) {
}
}
+func (w *exportWriter) commList(cases []*ir.CommStmt) {
+ w.uint64(uint64(len(cases)))
+ for _, cas := range cases {
+ w.pos(cas.Pos())
+ w.stmtList(cas.List)
+ w.stmtList(cas.Body)
+ }
+}
+
func (w *exportWriter) exprList(list ir.Nodes) {
for _, n := range list {
w.expr(n)