(iterable traits.Iterable)
| 1982 | } |
| 1983 | |
| 1984 | func (f *folder) foldIterable(iterable traits.Iterable) ref.Val { |
| 1985 | it := iterable.Iterator() |
| 1986 | for it.HasNext() == types.True { |
| 1987 | f.iterVar1Val = it.Next() |
| 1988 | |
| 1989 | cond := f.cond.Exec(f.frame) |
| 1990 | if f.interrupted { |
| 1991 | return f.evalResult() |
| 1992 | } |
| 1993 | if !f.exhaustive && cond != types.True { |
| 1994 | if isError(cond) { |
| 1995 | f.interrupted = true |
| 1996 | } |
| 1997 | return f.evalResult() |
| 1998 | } |
| 1999 | |
| 2000 | // Update the accumulation value and check for eval interruption. |
| 2001 | f.accuVal = f.step.Exec(f.frame) |
| 2002 | f.initialized = true |
| 2003 | if f.interruptable && f.frame.CheckInterrupt() { |
| 2004 | f.interrupted = true |
| 2005 | return f.evalResult() |
| 2006 | } |
| 2007 | } |
| 2008 | return f.evalResult() |
| 2009 | } |
| 2010 | |
| 2011 | // FoldKeyOnly reports whether the folder only consumes the entry key (e.g. 1-variable map |
| 2012 | // comprehensions where iterVar2 is empty and listV1Fold is false). |
no test coverage detected