From 7189a02ca520df9e9a5612851bd7c68c55b678e3 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 19 Apr 2017 06:35:18 -0700 Subject: [PATCH] cmd/compile: remove haslabelgoto As of CL 39998, it is no longer necessary. Fixes #19699 Change-Id: Ie1c49c8468073c6ddeb96c03668705cf81d40c98 Reviewed-on: https://go-review.googlesource.com/41051 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Matthew Dempsky --- src/cmd/compile/internal/gc/typecheck.go | 26 ++---------------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 58961a8b16..03320b1407 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -3957,16 +3957,10 @@ func deadcodeslice(nn Nodes) { continue } if n.Op == OIF && Isconst(n.Left, CTBOOL) { - var dead *Nodes if n.Left.Bool() { - dead = &n.Rlist + n.Rlist = Nodes{} } else { - dead = &n.Nbody - } - // TODO(mdempsky/josharian): eliminate need for haslabelgoto - // by checking labels and gotos earlier. See issue 19699. - if !(*dead).haslabelgoto() { - *dead = Nodes{} + n.Nbody = Nodes{} } } deadcodeslice(n.Ninit) @@ -3975,19 +3969,3 @@ func deadcodeslice(nn Nodes) { deadcodeslice(n.Rlist) } } - -// haslabelgoto reports whether the Nodes list contains any label or goto statements. -func (l Nodes) haslabelgoto() bool { - for _, n := range l.Slice() { - if n == nil { - continue - } - if n.Op == OLABEL || n.Op == OGOTO { - return true - } - if n.Ninit.haslabelgoto() || n.Nbody.haslabelgoto() || n.List.haslabelgoto() || n.Rlist.haslabelgoto() { - return true - } - } - return false -}