(iterable traits.Iterable)
| 1553 | } |
| 1554 | |
| 1555 | func (f *folder) foldIterable(iterable traits.Iterable) ref.Val { |
| 1556 | it := iterable.Iterator() |
| 1557 | for it.HasNext() == types.True { |
| 1558 | f.iterVar1Val = it.Next() |
| 1559 | |
| 1560 | cond := f.cond.Exec(f.frame) |
| 1561 | condBool, ok := cond.(types.Bool) |
| 1562 | if f.interrupted || (!f.exhaustive && ok && condBool != types.True) { |
| 1563 | return f.evalResult() |
| 1564 | } |
| 1565 | |
| 1566 | // Update the accumulation value and check for eval interuption. |
| 1567 | f.accuVal = f.step.Exec(f.frame) |
| 1568 | f.initialized = true |
| 1569 | if f.interruptable && f.frame.CheckInterrupt() { |
| 1570 | f.interrupted = true |
| 1571 | return f.evalResult() |
| 1572 | } |
| 1573 | } |
| 1574 | return f.evalResult() |
| 1575 | } |
| 1576 | |
| 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. |
no test coverage detected