mirror of
https://github.com/golang/go
synced 2024-11-05 20:16:13 -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:
|
case *ast.ValueSpec:
|
||||||
// TODO(adonovan): ValueSpec.{Doc,Comment}?
|
// TODO(adonovan): ValueSpec.{Doc,Comment}?
|
||||||
|
|
||||||
default:
|
case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt:
|
||||||
// Includes *ast.BadDecl, *ast.BadExpr, *ast.BadStmt.
|
// nop
|
||||||
panic(fmt.Sprintf("unexpected node type %T", n))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(adonovan): opt: merge the logic of ast.Inspect() into
|
// TODO(adonovan): opt: merge the logic of ast.Inspect() into
|
||||||
|
Loading…
Reference in New Issue
Block a user