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

Method Check

patcher/operator_override.go:111–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111func (p *OperatorOverloading) Check() {
112 for _, fn := range p.Overloads {
113 fnType, foundType := p.Env.Get(p.NtCache, fn)
114 fnFunc, foundFunc := p.Functions[fn]
115 if !foundFunc && (!foundType || fnType.Type.Kind() != reflect.Func) {
116 panic(fmt.Errorf("function %s for %s operator does not exist in the environment", fn, p.Operator))
117 }
118
119 if foundType {
120 checkType(fnType, fn, p.Operator)
121 }
122
123 if foundFunc {
124 checkFunc(fnFunc, fn, p.Operator)
125 }
126 }
127}
128
129func checkType(fnType nature.Nature, fn string, operator string) {
130 requiredNumIn := 2

Callers

nothing calls this directly

Calls 4

checkTypeFunction · 0.85
checkFuncFunction · 0.85
GetMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected