(frame *interpreter.ExecutionFrame)
| 1022 | } |
| 1023 | |
| 1024 | func (opt *evalOptionalOr) Exec(frame *interpreter.ExecutionFrame) ref.Val { |
| 1025 | // short-circuit lhs. |
| 1026 | optLHS := opt.lhs.Exec(frame) |
| 1027 | switch val := optLHS.(type) { |
| 1028 | case *types.Err, *types.Unknown: |
| 1029 | return optLHS |
| 1030 | case *types.Optional: |
| 1031 | if val.HasValue() { |
| 1032 | return optLHS |
| 1033 | } |
| 1034 | return opt.rhs.Exec(frame) |
| 1035 | default: |
| 1036 | return types.NoSuchOverloadErr() |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | // Eval evaluates the left-hand side optional to determine whether it contains a value, else |
| 1041 | // proceeds with the right-hand side evaluation. |
nothing calls this directly
no test coverage detected