Skip to content

Commit 27278b6

Browse files
committed
FIX: COMPOSE/into of non-block doesn't insert into target
fixes: metaeducation/rebol-issues#2062
1 parent 6d14eea commit 27278b6

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/core/n-control.c

+20-3
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,27 @@ enum {
476476
***********************************************************************/
477477
{
478478
REBVAL *value = D_ARG(1);
479+
REBVAL *into = D_REF(4) ? D_ARG(5) : 0;
479480

480-
if (!IS_BLOCK(value)) return R_ARG1;
481-
Compose_Block(value, D_REF(2), D_REF(3), D_REF(4) ? D_ARG(5) : 0);
482-
return R_TOS;
481+
if (IS_BLOCK(value)) {
482+
Compose_Block(value, D_REF(2), D_REF(3), into);
483+
return R_TOS;
484+
}
485+
else if (into != 0) {
486+
REBINT start = DSP + 1;
487+
if (IS_WORD(value)) {
488+
value = Get_Var(value);
489+
DS_PUSH(value);
490+
}
491+
else if (IS_PATH(value)) {
492+
Do_Path(&value, 0); // pushes val on stack
493+
}
494+
else DS_PUSH(value);
495+
Copy_Stack_Values(start, into);
496+
return R_TOS;
497+
}
498+
499+
return R_ARG1;
483500
}
484501

485502

0 commit comments

Comments
 (0)