SetDefaultVars sets the default variables activation for the frame, composing it with any existing scope activation.
(defaultVars Activation)
| 110 | // SetDefaultVars sets the default variables activation for the frame, composing it |
| 111 | // with any existing scope activation. |
| 112 | func (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. |
| 135 | func NewExecutionFrame(input any) (*ExecutionFrame, error) { |