Skip to content

Commit 787cc4e

Browse files
committed
fix #840: pointer to struct env not returning fields
1 parent d5909bb commit 787cc4e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

checker/nature/nature.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,15 @@ func (n *Nature) getSlow(c *Cache, name string) (Nature, bool) {
404404
if nt, ok := n.MethodByName(c, name); ok {
405405
return nt, true
406406
}
407-
if n.Kind == reflect.Struct {
408-
if sf := n.structField(c, nil, name); sf != nil {
407+
t, k, changed := deref.TypeKind(n.Type, n.Kind)
408+
if k == reflect.Struct {
409+
var sd *structData
410+
if changed {
411+
sd = c.getStruct(t).structData
412+
} else {
413+
sd = n.structData
414+
}
415+
if sf := sd.structField(c, nil, name); sf != nil {
409416
return sf.Nature, true
410417
}
411418
}

0 commit comments

Comments
 (0)