]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove Label type
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 27 Oct 2016 00:14:35 +0000 (17:14 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 27 Oct 2016 01:44:23 +0000 (01:44 +0000)
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>

src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/typecheck.go

index a3ef2e34c14558e39625ae33e0ed3c386d18da40..45c0d789d1e686365a4dda0d667d1d7a00192b1d 100644 (file)
@@ -589,9 +589,10 @@ func (e *EscState) escfunc(fn *Node) {
 // 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
 // and set it to one of the following two. Then in esc we'll clear it again.
-var looping Label
-
-var nonlooping Label
+var (
+       looping    Node
+       nonlooping Node
+)
 
 func (e *EscState) escloopdepthlist(l Nodes) {
        for _, n := range l.Slice() {
index 97066cde0165fb6159b49095fa5aa3f20b28cc6d..9ab1a8557de7254f83fb7395818c90b1d99aa0c4 100644 (file)
@@ -47,16 +47,12 @@ type Sym struct {
        Block      int32  // blocknumber to catch redeclaration
        Lastlineno int32  // last declaration for diagnostic
 
-       Label   *Label // corresponding label (ephemeral)
-       Origpkg *Pkg   // original package for . import
+       Label   *Node // corresponding label (ephemeral)
+       Origpkg *Pkg  // original package for . import
        Lsym    *obj.LSym
        Fsym    *Sym // funcsym
 }
 
-type Label struct {
-       Def *Node
-}
-
 type SymFlags uint8
 
 const (
index 7de8ab7d0483a03c2b67ae902f2a8c8aee2fc0d8..eb95c20992953911af330d7953526fb9cb8db172 100644 (file)
@@ -3841,7 +3841,7 @@ func markbreak(n *Node, implicit *Node) {
                } else {
                        lab := n.Left.Sym.Label
                        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] {
                        switch n.Name.Defn.Op {
                        case OFOR, OSWITCH, OTYPESW, OSELECT, ORANGE:
-                               lab := new(Label)
-                               lab.Def = n.Name.Defn
-                               n.Left.Sym.Label = lab
+                               n.Left.Sym.Label = n.Name.Defn
                                markbreak(n.Name.Defn, n.Name.Defn)
                                n.Left.Sym.Label = nil
                                i++