1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:14:43 -07:00

cmd/compile: remove Label type

With the removal of the old backend,
a Label is just a Node.

Passes toolstash -cmp.

Change-Id: Ia62cb00fbc551efb75a4ed4dc6ed54fca0831dbf
Reviewed-on: https://go-review.googlesource.com/32216
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2016-10-26 17:14:35 -07:00
parent d6dbf3a0d3
commit a7c84668c8
3 changed files with 8 additions and 13 deletions

View File

@ -589,9 +589,10 @@ func (e *EscState) escfunc(fn *Node) {
// Mark labels that have no backjumps to them as not increasing e.loopdepth. // Mark labels that have no backjumps to them as not increasing e.loopdepth.
// Walk hasn't generated (goto|label).Left.Sym.Label yet, so we'll cheat // Walk hasn't generated (goto|label).Left.Sym.Label yet, so we'll cheat
// and set it to one of the following two. Then in esc we'll clear it again. // and set it to one of the following two. Then in esc we'll clear it again.
var looping Label var (
looping Node
var nonlooping Label nonlooping Node
)
func (e *EscState) escloopdepthlist(l Nodes) { func (e *EscState) escloopdepthlist(l Nodes) {
for _, n := range l.Slice() { for _, n := range l.Slice() {

View File

@ -47,16 +47,12 @@ type Sym struct {
Block int32 // blocknumber to catch redeclaration Block int32 // blocknumber to catch redeclaration
Lastlineno int32 // last declaration for diagnostic Lastlineno int32 // last declaration for diagnostic
Label *Label // corresponding label (ephemeral) Label *Node // corresponding label (ephemeral)
Origpkg *Pkg // original package for . import Origpkg *Pkg // original package for . import
Lsym *obj.LSym Lsym *obj.LSym
Fsym *Sym // funcsym Fsym *Sym // funcsym
} }
type Label struct {
Def *Node
}
type SymFlags uint8 type SymFlags uint8
const ( const (

View File

@ -3841,7 +3841,7 @@ func markbreak(n *Node, implicit *Node) {
} else { } else {
lab := n.Left.Sym.Label lab := n.Left.Sym.Label
if lab != nil { if lab != nil {
lab.Def.SetHasBreak(true) lab.SetHasBreak(true)
} }
} }
@ -3872,9 +3872,7 @@ func markbreaklist(l Nodes, implicit *Node) {
if n.Op == OLABEL && i+1 < len(s) && n.Name.Defn == s[i+1] { if n.Op == OLABEL && i+1 < len(s) && n.Name.Defn == s[i+1] {
switch n.Name.Defn.Op { switch n.Name.Defn.Op {
case OFOR, OSWITCH, OTYPESW, OSELECT, ORANGE: case OFOR, OSWITCH, OTYPESW, OSELECT, ORANGE:
lab := new(Label) n.Left.Sym.Label = n.Name.Defn
lab.Def = n.Name.Defn
n.Left.Sym.Label = lab
markbreak(n.Name.Defn, n.Name.Defn) markbreak(n.Name.Defn, n.Name.Defn)
n.Left.Sym.Label = nil n.Left.Sym.Label = nil
i++ i++