Skip to content

Commit 1c04463

Browse files
committed
Revert "Fix foreach with set-word"
This reverts commit 63115b1. because it breaks the following code in r3-gui.r3 unless foreach [here: hand] sys-hand [ if handler/priority > hand/priority [ insert here handler break/return true ] ] [ append sys-hand handler ]
1 parent 2000bd5 commit 1c04463

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/core/n-loop.c

+16-17
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@
331331
vars = FRM_VALUE(frame, i);
332332
words = FRM_WORD(frame, i);
333333

334-
if (index < tail) {
335-
// var spec is WORD
336-
if (IS_WORD(words)) {
334+
// var spec is WORD
335+
if (IS_WORD(words)) {
337336

337+
if (index < tail) {
338338

339339
if (ANY_BLOCK(value)) {
340340
*vars = *BLK_SKIP(series, index);
@@ -395,24 +395,23 @@
395395
VAL_CHAR(vars) = GET_ANY_CHAR(series, index);
396396
}
397397
}
398+
index++;
398399
}
400+
else SET_NONE(vars);
401+
}
399402

400-
// var spec is WORD:
401-
else if (IS_SET_WORD(words)) {
402-
if (ANY_OBJECT(value) || IS_MAP(value)) {
403-
*vars = *value;
404-
} else {
405-
VAL_SET(vars, REB_BLOCK);
406-
VAL_SERIES(vars) = series;
407-
VAL_INDEX(vars) = index;
408-
}
409-
//if (index < tail) index++; // do not increment block.
403+
// var spec is WORD:
404+
else if (IS_SET_WORD(words)) {
405+
if (ANY_OBJECT(value) || IS_MAP(value)) {
406+
*vars = *value;
407+
} else {
408+
VAL_SET(vars, REB_BLOCK);
409+
VAL_SERIES(vars) = series;
410+
VAL_INDEX(vars) = index;
410411
}
411-
else Trap_Arg(words);
412-
413-
index++;
412+
//if (index < tail) index++; // do not increment block.
414413
}
415-
else SET_NONE(vars);
414+
else Trap_Arg(words);
416415
}
417416

418417
ds = Do_Blk(body, 0);

0 commit comments

Comments
 (0)