| 23 | } |
| 24 | |
| 25 | static Record OptionalConsume(OpBase *opBase) { |
| 26 | Optional *op = (Optional *)opBase; |
| 27 | // try to produce a Record from the child op. |
| 28 | Record r = OpBase_Consume(opBase->children[0]); |
| 29 | |
| 30 | // create an empty Record if the child returned NULL |
| 31 | // and this op has not yet returned data. |
| 32 | if(!r && !op->emitted_record) { |
| 33 | r = OpBase_CreateRecord(opBase); |
| 34 | } |
| 35 | |
| 36 | // don't produce multiple empty Records. |
| 37 | op->emitted_record = true; |
| 38 | |
| 39 | return r; |
| 40 | } |
| 41 | |
| 42 | static OpResult OptionalReset(OpBase *opBase) { |
| 43 | Optional *op = (Optional *)opBase; |
nothing calls this directly
no test coverage detected