Resolve evaluates the condition, and then resolves the truthy or falsy branch accordingly.
(vars Activation)
| 570 | |
| 571 | // Resolve evaluates the condition, and then resolves the truthy or falsy branch accordingly. |
| 572 | func (a *conditionalAttribute) Resolve(vars Activation) (any, error) { |
| 573 | val := a.expr.Eval(vars) |
| 574 | if val == types.True { |
| 575 | return a.truthy.Resolve(vars) |
| 576 | } |
| 577 | if val == types.False { |
| 578 | return a.falsy.Resolve(vars) |
| 579 | } |
| 580 | if types.IsUnknown(val) { |
| 581 | return val, nil |
| 582 | } |
| 583 | return nil, types.MaybeNoSuchOverloadErr(val).(*types.Err) |
| 584 | } |
| 585 | |
| 586 | // String is an implementation of the Stringer interface method. |
| 587 | func (a *conditionalAttribute) String() string { |
nothing calls this directly
no test coverage detected