MCPcopy
hub / github.com/expr-lang/expr / getStruct

Method getStruct

checker/nature/nature.go:150–169  ·  view source on GitHub ↗
(t reflect.Type)

Source from the content-addressed store, hash-verified

148}
149
150func (c *Cache) getStruct(t reflect.Type) Nature {
151 if c.structs == nil {
152 c.structs = map[reflect.Type]Nature{}
153 } else if nt, ok := c.structs[t]; ok {
154 return nt
155 }
156 nt := Nature{
157 Type: t,
158 Kind: reflect.Struct,
159 TypeData: &TypeData{
160 structData: &structData{
161 rType: t,
162 numField: t.NumField(),
163 anonIdx: -1, // do not lookup embedded fields yet
164 },
165 },
166 }
167 c.structs[t] = nt
168 return nt
169}
170
171func (c *Cache) getMethodset(t reflect.Type, k reflect.Kind) *methodset {
172 if t == nil || c == nil {

Callers 5

FromTypeMethod · 0.95
structFieldMethod · 0.80
StructFieldsFunction · 0.80
FieldByNameMethod · 0.80
getSlowMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected