cmd/compile: remove a few unnecessary gotos

Rework the logic to remove them. These were the low hanging fruit,
with labels that were used only once and logic that was fairly
straightforward.

Change-Id: I02a01c59c247b8b2972d8d73ff23f96f271de038
Reviewed-on: https://go-review.googlesource.com/63410
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Daniel Martí 2017-09-12 22:51:17 +02:00
parent f260ae6523
commit 83f0af1742
4 changed files with 19 additions and 24 deletions

View file

@ -1165,19 +1165,17 @@ func dtypesym(t *types.Type) *types.Sym {
dupok = obj.DUPOK
}
if myimportpath == "runtime" && (tbase == types.Types[tbase.Etype] || tbase == types.Bytetype || tbase == types.Runetype || tbase == types.Errortype) { // int, float, etc
goto ok
if myimportpath != "runtime" || (tbase != types.Types[tbase.Etype] && tbase != types.Bytetype && tbase != types.Runetype && tbase != types.Errortype) { // int, float, etc
// named types from other files are defined only by those files
if tbase.Sym != nil && !tbase.Local() {
return s
}
// TODO(mdempsky): Investigate whether this can happen.
if isforw[tbase.Etype] {
return s
}
}
// named types from other files are defined only by those files
if tbase.Sym != nil && !tbase.Local() {
return s
}
if isforw[tbase.Etype] {
return s
}
ok:
ot := 0
lsym := s.Linksym()
switch t.Etype {