]> Cypherpunks repositories - gostls13.git/commit
go/ast: fix ast.Walk
authorRobert Griesemer <gri@golang.org>
Thu, 9 Dec 2010 18:22:01 +0000 (10:22 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 9 Dec 2010 18:22:01 +0000 (10:22 -0800)
commite1d6b3c98d70a62000f452ff72be3ab2a0640dda
tree777dc8afbad3a28a76fdc6e86fa70f63c6774007
parente2da3b64986333af32592f49012ad9cb566804f0
go/ast: fix ast.Walk

- change Walk signature to use an ast.Node instead of interface{}
- add Pos functions to a couple of ast types to make them proper nodes
- explicit nil checks where a node can be nil; incorrect ASTs cause Walk to crash

For now ast.Walk is exercised extensively as part of godoc's indexer;
so we have some confidence in its correctness. But this needs a test,
eventually.

Fixes #1326.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3481043
src/cmd/godoc/index.go
src/cmd/gofmt/simplify.go
src/cmd/govet/govet.go
src/pkg/go/ast/ast.go
src/pkg/go/ast/walk.go
src/pkg/go/printer/nodes.go