FoldEntry will either fold comprehension v1 style macros if iterVar2 is unset, or comprehension v2 style macros if both the iterVar and iterVar2 are set to non-empty strings.
(key, val any)
| 1577 | // FoldEntry will either fold comprehension v1 style macros if iterVar2 is unset, or comprehension v2 style |
| 1578 | // macros if both the iterVar and iterVar2 are set to non-empty strings. |
| 1579 | func (f *folder) FoldEntry(key, val any) bool { |
| 1580 | // Default to referencing both values. |
| 1581 | f.iterVar1Val = key |
| 1582 | f.iterVar2Val = val |
| 1583 | |
| 1584 | // Terminate evaluation if evaluation is interrupted or the condition is not true and exhaustive |
| 1585 | // eval is not enabled. |
| 1586 | cond := f.cond.Exec(f.frame) |
| 1587 | condBool, ok := cond.(types.Bool) |
| 1588 | if f.interrupted || (!f.exhaustive && ok && condBool != types.True) { |
| 1589 | return false |
| 1590 | } |
| 1591 | |
| 1592 | // Update the accumulation value and check for eval interuption. |
| 1593 | f.accuVal = f.step.Exec(f.frame) |
| 1594 | f.initialized = true |
| 1595 | if f.interruptable && f.frame.CheckInterrupt() { |
| 1596 | f.interrupted = true |
| 1597 | return false |
| 1598 | } |
| 1599 | return true |
| 1600 | } |
| 1601 | |
| 1602 | // ResolveName overrides the default Activation lookup to perform lazy initialization of the accumulator |
| 1603 | // and specialized lookups of iteration values with consideration for whether the final result is being |
nothing calls this directly
no test coverage detected