Skip to content

Commit

Permalink
cmd/compile/internal/gc: use slice instead of NodeList for Label.Use
Browse files Browse the repository at this point in the history
Change-Id: I021c95df24edbff24ff2922769ef2b2acd47016a
Reviewed-on: https://go-review.googlesource.com/14081
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Dave Cheney <[email protected]>
  • Loading branch information
osocurioso authored and bradfitz committed Sep 1, 2015
1 parent e8da46f commit dd42eff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/cmd/compile/internal/gc/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func newlab(n *Node) *Label {
lab.Def = n
}
} else {
lab.Use = list(lab.Use, n)
lab.Use = append(lab.Use, n)
}

return lab
Expand Down Expand Up @@ -986,12 +986,10 @@ func CgenTemp(n *Node) *Node {
}

func checklabels() {
var l *NodeList

for lab := labellist; lab != nil; lab = lab.Link {
if lab.Def == nil {
for l = lab.Use; l != nil; l = l.Next {
yyerrorl(int(l.N.Lineno), "label %v not defined", lab.Sym)
for _, n := range lab.Use {
yyerrorl(int(n.Lineno), "label %v not defined", lab.Sym)
}
continue
}
Expand All @@ -1004,8 +1002,8 @@ func checklabels() {
if lab.Gotopc != nil {
Fatalf("label %v never resolved", lab.Sym)
}
for l = lab.Use; l != nil; l = l.Next {
checkgoto(l.N, lab.Def)
for _, n := range lab.Use {
checkgoto(n, lab.Def)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/gc/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ type Label struct {
Used uint8
Sym *Sym
Def *Node
Use *NodeList
Use []*Node
Link *Label

// for use during gen
Expand Down

0 comments on commit dd42eff

Please sign in to comment.