(frame *interpreter.ExecutionFrame)
| 730 | } |
| 731 | |
| 732 | func (opt *evalOptionalOr) Exec(frame *interpreter.ExecutionFrame) ref.Val { |
| 733 | // short-circuit lhs. |
| 734 | optLHS := opt.lhs.Exec(frame) |
| 735 | switch val := optLHS.(type) { |
| 736 | case *types.Err, *types.Unknown: |
| 737 | return optLHS |
| 738 | case *types.Optional: |
| 739 | if val.HasValue() { |
| 740 | return optLHS |
| 741 | } |
| 742 | return opt.rhs.Exec(frame) |
| 743 | default: |
| 744 | return types.NoSuchOverloadErr() |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | // Eval evaluates the left-hand side optional to determine whether it contains a value, else |
| 749 | // proceeds with the right-hand side evaluation. |
no test coverage detected