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

Method SetDefaultVars

interpreter/frame.go:112–132  ·  view source on GitHub ↗

SetDefaultVars sets the default variables activation for the frame, composing it with any existing scope activation.

(defaultVars Activation)

Source from the content-addressed store, hash-verified

110// SetDefaultVars sets the default variables activation for the frame, composing it
111// with any existing scope activation.
112func (f *ExecutionFrame) SetDefaultVars(defaultVars Activation) error {
113 if defaultVars == nil {
114 return nil
115 }
116 fns, err := FindFunctionActivation(defaultVars)
117 if err != nil {
118 return err
119 }
120 if fns != nil {
121 if f.functions != nil {
122 return errNestedFunctionActivation
123 }
124 f.functions = fns
125 }
126 if f.scope != nil {
127 f.scope = NewHierarchicalActivation(defaultVars, f.scope)
128 } else {
129 f.scope = defaultVars
130 }
131 return nil
132}
133
134// NewExecutionFrame creates a new execution frame from the pool.
135func NewExecutionFrame(input any) (*ExecutionFrame, error) {

Calls 2

FindFunctionActivationFunction · 0.85