diff options
author | Matthew Dempsky <mdempsky@google.com> | 2020-12-26 22:42:17 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2020-12-28 08:01:27 +0000 |
commit | 2ecf52b841cd48e76df1fe721d29a972c22bf93f (patch) | |
tree | e0987204c1c40aebfb04538ff0e26399e9090255 /src/cmd/compile/internal/typecheck/iimport.go | |
parent | ed9772e130d81b3a5a7b9e9b58e8d48a5ec4c319 (diff) | |
download | go-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/iimport.go')
-rw-r--r-- | src/cmd/compile/internal/typecheck/iimport.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go index fd8314b662..ba7ea2f156 100644 --- a/src/cmd/compile/internal/typecheck/iimport.go +++ b/src/cmd/compile/internal/typecheck/iimport.go @@ -789,6 +789,14 @@ func (r *importReader) caseList(switchExpr ir.Node) []*ir.CaseStmt { return cases } +func (r *importReader) commList() []*ir.CommStmt { + cases := make([]*ir.CommStmt, r.uint64()) + for i := range cases { + cases[i] = ir.NewCommStmt(r.pos(), r.stmtList(), r.stmtList()) + } + return cases +} + func (r *importReader) exprList() []ir.Node { var list []ir.Node for { @@ -1035,7 +1043,7 @@ func (r *importReader) node() ir.Node { case ir.OSELECT: pos := r.pos() init := r.stmtList() - n := ir.NewSelectStmt(pos, r.caseList(nil)) + n := ir.NewSelectStmt(pos, r.commList()) n.PtrInit().Set(init) return n |