MCPcopy Create free account
hub / github.com/cel-expr/cel-go / FindFunction

Method FindFunction

checker/scopes.go:119–135  ·  view source on GitHub ↗

FindFunction finds the first function Decl with a matching name in Scopes. The search is performed from innermost to outermost. Returns nil if no such function in Scopes.

(name string)

Source from the content-addressed store, hash-verified

117// The search is performed from innermost to outermost.
118// Returns nil if no such function in Scopes.
119func (s *Scopes) FindFunction(name string) *decls.FunctionDecl {
120 name = strings.TrimPrefix(name, ".")
121 if fn, found := s.scopes.functions[name]; found {
122 return fn
123 }
124 if s.parent != nil {
125 if fn := s.parent.FindFunction(name); fn != nil {
126 return fn
127 }
128 }
129 if s.inherited != nil {
130 if fn := s.inherited.FindFunction(name); fn != nil {
131 return fn
132 }
133 }
134 return nil
135}
136
137// Group is a set of Decls that is pushed on or popped off a Scopes as a unit.
138// Contains separate namespaces for identifier and function Decls.

Callers 2

lookupFunctionMethod · 0.80
setFunctionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected