(frame *interpreter.ExecutionFrame)
| 1057 | } |
| 1058 | |
| 1059 | func (opt *evalOptionalOrValue) Exec(frame *interpreter.ExecutionFrame) ref.Val { |
| 1060 | // short-circuit lhs. |
| 1061 | optLHS := opt.lhs.Exec(frame) |
| 1062 | |
| 1063 | switch val := optLHS.(type) { |
| 1064 | case *types.Err, *types.Unknown: |
| 1065 | return optLHS |
| 1066 | case *types.Optional: |
| 1067 | if val.HasValue() { |
| 1068 | return val.GetValue() |
| 1069 | } |
| 1070 | return opt.rhs.Exec(frame) |
| 1071 | default: |
| 1072 | return types.NoSuchOverloadErr() |
| 1073 | } |
| 1074 | } |
| 1075 | |
| 1076 | // Eval evaluates the left-hand side optional to determine whether it contains a value, else |
| 1077 | // proceeds with the right-hand side evaluation. |
nothing calls this directly
no test coverage detected