MCPcopy Create free account
hub / github.com/expr-lang/expr / Interface

Function Interface

internal/deref/deref.go:8–27  ·  view source on GitHub ↗
(p any)

Source from the content-addressed store, hash-verified

6)
7
8func Interface(p any) any {
9 if p == nil {
10 return nil
11 }
12
13 v := reflect.ValueOf(p)
14
15 for v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface {
16 if v.IsNil() {
17 return nil
18 }
19 v = v.Elem()
20 }
21
22 if v.IsValid() {
23 return v.Interface()
24 }
25
26 panic(fmt.Sprintf("cannot dereference %v", p))
27}
28
29func Type(t reflect.Type) reflect.Type {
30 if t == nil {

Callers 4

TestDerefFunction · 0.92
TestDeref_nilFunction · 0.92
RunMethod · 0.92

Calls 2

ElemMethod · 0.80
SprintfMethod · 0.80

Tested by 3

TestDerefFunction · 0.74
TestDeref_nilFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…