Branch: Tag:

2003-09-05

2003-09-05 15:19:20 by Martin Stjernholm <mast@lysator.liu.se>

Changed foreach to step the iterator after the loop instead of before it, so
that the iterator points to the current element instead of the next one.
Also some cleanup in iterators.cmod and a bit better error checking in
get_iterator.

Rev: src/builtin_functions.h:1.27
Rev: src/docode.c:1.166
Rev: src/interpret_functions.h:1.156
Rev: src/iterators.cmod:1.47
Rev: src/testsuite.in:1.673

1: - test_true([["$Id: testsuite.in,v 1.672 2003/08/26 18:33:20 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.673 2003/09/05 15:19:20 mast Exp $"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])
6840:    return i;   ]])    + test_any([[ +  String.Iterator iter = String.Iterator ("foo"); +  foreach (iter; int idx;) +  if (idx != iter->index()) return 1; +  return 0; + ]], 0) +    // do-while   test_any(int e;string t=""; e=0; do{ t+=e; }while(++e<6); return t,"012345";)