mirror of
https://github.com/golang/go
synced 2024-11-18 09:04:49 -07:00
cmd/guru: report 'whicherrs' in modes of 'what' query
A 'what' query reports which other query modes are applicable to the selected syntax. A 'whicherrs' query is similar to a 'pointsto' query, so we enable it using the same criteria. Fixes issue golang/go#18938 Change-Id: Iae062e0c933c7764bc335488adabf816d63ac837 Reviewed-on: https://go-review.googlesource.com/37349 Reviewed-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
parent
a663d825ff
commit
3537037b0b
@ -74,7 +74,7 @@ func what(q *Query) error {
|
||||
}
|
||||
}
|
||||
|
||||
// For pointsto, we approximate findInterestingNode.
|
||||
// For pointsto and whicherrs, we approximate findInterestingNode.
|
||||
if _, ok := enable["pointsto"]; !ok {
|
||||
switch n.(type) {
|
||||
case ast.Stmt,
|
||||
@ -84,10 +84,14 @@ func what(q *Query) error {
|
||||
*ast.InterfaceType,
|
||||
*ast.MapType,
|
||||
*ast.ChanType:
|
||||
enable["pointsto"] = false // not an expr
|
||||
// not an expression
|
||||
enable["pointsto"] = false
|
||||
enable["whicherrs"] = false
|
||||
|
||||
case ast.Expr, ast.Decl, *ast.ValueSpec:
|
||||
enable["pointsto"] = true // an expr, maybe
|
||||
// an expression, maybe
|
||||
enable["pointsto"] = true
|
||||
enable["whicherrs"] = true
|
||||
|
||||
default:
|
||||
// Comment, Field, KeyValueExpr, etc: ascend.
|
||||
|
Loading…
Reference in New Issue
Block a user