Skip to content

Commit

Permalink
ATRONIX/FIX: Fix break from remove-each
Browse files Browse the repository at this point in the history
Reported by MichaT from altme.

This is what the actual result:
>> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s
1
2
== [3 4]

This is what's expected:
>> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s
1
2
== [2 3 4]

Fixes: metaeducation/rebol-issues#2192

(cherry picked from commit b336459)
  • Loading branch information
Oldes committed Jun 25, 2018
1 parent e41a254 commit 9a9b195
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/n-loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@
ds = Do_Blk(body, 0);

if (THROWN(ds)) {
if ((err = Check_Error(ds)) >= 0) break;
if ((err = Check_Error(ds)) >= 0) {
index = rindex;
break;
}
// else CONTINUE:
if (mode == 1) SET_FALSE(ds); // keep the value (for mode == 1)
} else {
Expand Down

0 comments on commit 9a9b195

Please sign in to comment.