Exec implements the InterpretableV2 interface method.
(frame *ExecutionFrame)
| 1805 | |
| 1806 | // Exec implements the InterpretableV2 interface method. |
| 1807 | func (cond *evalExhaustiveConditional) Exec(frame *ExecutionFrame) ref.Val { |
| 1808 | cVal := cond.attr.expr.Exec(frame) |
| 1809 | tVal, tErr := cond.attr.truthy.Resolve(frame) |
| 1810 | fVal, fErr := cond.attr.falsy.Resolve(frame) |
| 1811 | cBool, ok := cVal.(types.Bool) |
| 1812 | if !ok { |
| 1813 | return types.ValOrErr(cVal, "no such overload") |
| 1814 | } |
| 1815 | if cBool { |
| 1816 | if tErr != nil { |
| 1817 | return types.LabelErrNode(cond.id, types.WrapErr(tErr)) |
| 1818 | } |
| 1819 | return cond.adapter.NativeToValue(tVal) |
| 1820 | } |
| 1821 | if fErr != nil { |
| 1822 | return types.LabelErrNode(cond.id, types.WrapErr(fErr)) |
| 1823 | } |
| 1824 | return cond.adapter.NativeToValue(fVal) |
| 1825 | } |
| 1826 | |
| 1827 | // Eval implements the Interpretable interface method. |
| 1828 | func (cond *evalExhaustiveConditional) Eval(ctx Activation) ref.Val { |
nothing calls this directly
no test coverage detected