MCPcopy Index your code
hub / github.com/expr-lang/expr / ConstExpr

Method ConstExpr

conf/config.go:76–85  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

74}
75
76func (c *Config) ConstExpr(name string) {
77 if c.EnvObject == nil {
78 panic("no environment is specified for ConstExpr()")
79 }
80 fn := reflect.ValueOf(runtime.Fetch(c.EnvObject, name))
81 if fn.Kind() != reflect.Func {
82 panic(fmt.Errorf("const expression %q must be a function", name))
83 }
84 c.ConstFns[name] = fn
85}
86
87type Checker interface {
88 Check()

Callers 2

ConstExprFunction · 0.80
TestOptimize_const_exprFunction · 0.80

Calls 2

FetchFunction · 0.92
ErrorfMethod · 0.65

Tested by 1

TestOptimize_const_exprFunction · 0.64