From deae10e0384c3224662946bc33e3a5badff782c6 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 14 Jul 2014 19:14:27 -0700 Subject: [PATCH] go/ast: fix walk to handle "for range x" LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/117790043 --- src/pkg/go/ast/walk.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkg/go/ast/walk.go b/src/pkg/go/ast/walk.go index fedffb3f22f..73ac38647a2 100644 --- a/src/pkg/go/ast/walk.go +++ b/src/pkg/go/ast/walk.go @@ -275,7 +275,9 @@ func Walk(v Visitor, node Node) { Walk(v, n.Body) case *RangeStmt: - Walk(v, n.Key) + if n.Key != nil { + Walk(v, n.Key) + } if n.Value != nil { Walk(v, n.Value) }