mirror of
https://github.com/golang/go
synced 2024-11-05 17:46:16 -07:00
cmd/guru: don't panic on *ast.Bad{Decl,Stmt,Expr}
These nodes are common in incomplete programs. Change-Id: Iff9750050c78762f0cb8bebc7739584c197d661e Reviewed-on: https://go-review.googlesource.com/19509 Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
d7762ee5c0
commit
cadb821a95
@ -447,9 +447,8 @@ func childrenOf(n ast.Node) []ast.Node {
|
||||
case *ast.ValueSpec:
|
||||
// TODO(adonovan): ValueSpec.{Doc,Comment}?
|
||||
|
||||
default:
|
||||
// Includes *ast.BadDecl, *ast.BadExpr, *ast.BadStmt.
|
||||
panic(fmt.Sprintf("unexpected node type %T", n))
|
||||
case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt:
|
||||
// nop
|
||||
}
|
||||
|
||||
// TODO(adonovan): opt: merge the logic of ast.Inspect() into
|
||||
|
Loading…
Reference in New Issue
Block a user