cmd/guru: fix nil dereference in describe
+ test Fixes issue golang/go#14579 Change-Id: I6fd56f10c170027f06917935ccbc28490d413d8a Reviewed-on: https://go-review.googlesource.com/20100 Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
8b178a93c1
commit
6f233b96df
|
|
@ -324,6 +324,9 @@ func describeValue(qpos *queryPos, path []ast.Node) (*describeValueResult, error
|
|||
}
|
||||
|
||||
t := qpos.info.TypeOf(expr)
|
||||
if t == nil {
|
||||
t = types.Typ[types.Invalid]
|
||||
}
|
||||
constVal := qpos.info.Types[expr].Value
|
||||
|
||||
return &describeValueResult{
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ func main() { // @describe func-def-main "main"
|
|||
var _ int // @describe var-def-blank "_"
|
||||
|
||||
var _ lib.Outer // @describe lib-outer "Outer"
|
||||
|
||||
unknown() // @describe call-unknown "\\("
|
||||
}
|
||||
|
||||
type I interface { // @describe def-iface-I "I"
|
||||
|
|
|
|||
|
|
@ -197,6 +197,9 @@ Fields:
|
|||
inner.C bool
|
||||
inner.recursive.E bool
|
||||
|
||||
-------- @describe call-unknown --------
|
||||
function call (or conversion) of type invalid type
|
||||
|
||||
-------- @describe def-iface-I --------
|
||||
definition of type I (size 16, align 8)
|
||||
Method set:
|
||||
|
|
|
|||
Loading…
Reference in New Issue