ResolveName implements the Activation interface by proxying to the internal activation.
(name string)
| 243 | |
| 244 | // ResolveName implements the Activation interface by proxying to the internal activation. |
| 245 | func (f *ExecutionFrame) ResolveName(name string) (any, bool) { |
| 246 | if f.vars != nil { |
| 247 | v, found := f.vars[name] |
| 248 | if found { |
| 249 | if f.lazyVars != nil { |
| 250 | if resolved, found := f.lazyVars[name]; found { |
| 251 | return resolved, true |
| 252 | } |
| 253 | } |
| 254 | var lazy any |
| 255 | switch obj := v.(type) { |
| 256 | case func() ref.Val: |
| 257 | lazy = obj() |
| 258 | case func() any: |
| 259 | lazy = obj() |
| 260 | default: |
| 261 | return obj, true |
| 262 | } |
| 263 | if f.lazyVars == nil { |
| 264 | f.lazyVars = make(map[string]any, 4) |
| 265 | } |
| 266 | f.lazyVars[name] = lazy |
| 267 | return lazy, true |
| 268 | } |
| 269 | } |
| 270 | if f.scope != nil { |
| 271 | if val, found := f.scope.ResolveName(name); found { |
| 272 | return val, true |
| 273 | } |
| 274 | } |
| 275 | if f.parent != nil { |
| 276 | return f.parent.ResolveName(name) |
| 277 | } |
| 278 | return nil, false |
| 279 | } |
| 280 | |
| 281 | // Parent implements the Activation interface by proxying to the parent frame or scope. |
| 282 | func (f *ExecutionFrame) Parent() Activation { |