]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: remove some more gotos in gc
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 22 Oct 2017 16:18:51 +0000 (17:18 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 13 Nov 2017 21:09:20 +0000 (21:09 +0000)
commit7f88d3c121a5a41f5fc286128d13f6b098dec6c1
tree1012220f6266f64f637e5f3d73292db7b84d09eb
parent1722a2d79dbf876d6f73e5c1276f070fe758c0f1
cmd/compile: remove some more gotos in gc

Split typecheckrange into two, separating the bigger chunk of code that
takes care of the range expression. It had to sometimes exit early,
which was done via a goto in the larger func. This lets us simplify many
declarations and the flow of the code. While at it, also replace the
toomany int with a bool.

In the case of walkselect, split it into two funcs too since using a
defer for all the trailing work would be a bit much. It also lets us
simplify the declarations and the flow of the code, since now
walkselectcases has a narrower scope and straightforward signature.

Also replace the gotos in typecheckaste with a lineno defer.

Passes toolstash -cmp on std cmd.

Change-Id: Iacfaa0a34c987c44f180a792c473558785cf6823
Reviewed-on: https://go-review.googlesource.com/72374
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/select.go
src/cmd/compile/internal/gc/typecheck.go