(iterable traits.Iterable)
| 1511 | } |
| 1512 | |
| 1513 | func (f *folder) foldIterable(iterable traits.Iterable) ref.Val { |
| 1514 | it := iterable.Iterator() |
| 1515 | for it.HasNext() == types.True { |
| 1516 | f.iterVar1Val = it.Next() |
| 1517 | |
| 1518 | cond := f.cond.Exec(f.frame) |
| 1519 | condBool, ok := cond.(types.Bool) |
| 1520 | if f.interrupted || (!f.exhaustive && ok && condBool != types.True) { |
| 1521 | return f.evalResult() |
| 1522 | } |
| 1523 | |
| 1524 | // Update the accumulation value and check for eval interuption. |
| 1525 | f.accuVal = f.step.Exec(f.frame) |
| 1526 | f.initialized = true |
| 1527 | if f.interruptable && f.frame.CheckInterrupt() { |
| 1528 | f.interrupted = true |
| 1529 | return f.evalResult() |
| 1530 | } |
| 1531 | } |
| 1532 | return f.evalResult() |
| 1533 | } |
| 1534 | |
| 1535 | // FoldEntry will either fold comprehension v1 style macros if iterVar2 is unset, or comprehension v2 style |
| 1536 | // macros if both the iterVar and iterVar2 are set to non-empty strings. |
no test coverage detected