Commit dd42eff8 authored by Håvard Haugen's avatar Håvard Haugen Committed by Brad Fitzpatrick

cmd/compile/internal/gc: use slice instead of NodeList for Label.Use

Change-Id: I021c95df24edbff24ff2922769ef2b2acd47016a
Reviewed-on: https://go-review.googlesource.com/14081
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDave Cheney <dave@cheney.net>
parent e8da46f6
......@@ -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
......@@ -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
}
......@@ -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)
}
}
}
......
......@@ -220,7 +220,7 @@ type Label struct {
Used uint8
Sym *Sym
Def *Node
Use *NodeList
Use []*Node
Link *Label
// for use during gen
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment