findFrame walks the activation hierarchy via Unwrap and Parent to locate an existing ExecutionFrame, if one exists.
(a Activation)
| 222 | // findFrame walks the activation hierarchy via Unwrap and Parent to locate an |
| 223 | // existing ExecutionFrame, if one exists. |
| 224 | func findFrame(a Activation) *ExecutionFrame { |
| 225 | if wrapper, ok := a.(activationWrapper); ok { |
| 226 | unwrapped := wrapper.Unwrap() |
| 227 | if f, ok := unwrapped.(*ExecutionFrame); ok { |
| 228 | return f |
| 229 | } |
| 230 | return findFrame(unwrapped) |
| 231 | } |
| 232 | if p := a.Parent(); p != nil { |
| 233 | if f, ok := p.(*ExecutionFrame); ok { |
| 234 | return f |
| 235 | } |
| 236 | return findFrame(p) |
| 237 | } |
| 238 | return nil |
| 239 | } |
| 240 | |
| 241 | // Core Interpretable implementations used during the program planning phase. |
| 242 |