mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
bind-rest works in the optional-and-rest-arg case.
* libguile/vm-engine.c (bind-rest): If the sp is below the dst reg, alloc the frame to ensure there is enough space, and to fill in intermediate values with SCM_UNDEFINED.
This commit is contained in:
parent
99511cd0ab
commit
234155e336
1 changed files with 14 additions and 5 deletions
|
@ -1586,16 +1586,25 @@ RTL_VM_NAME (SCM vm, SCM program, SCM *argv, size_t nargs_)
|
|||
SCM_UNPACK_RTL_24 (op, dst);
|
||||
nargs = FRAME_LOCALS_COUNT ();
|
||||
|
||||
while (nargs-- > dst)
|
||||
if (nargs <= dst)
|
||||
{
|
||||
rest = scm_cons (LOCAL_REF (nargs), rest);
|
||||
LOCAL_SET (nargs, SCM_UNDEFINED);
|
||||
ALLOC_FRAME (dst + 1);
|
||||
while (nargs < dst)
|
||||
LOCAL_SET (nargs++, SCM_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (nargs-- > dst)
|
||||
{
|
||||
rest = scm_cons (LOCAL_REF (nargs), rest);
|
||||
LOCAL_SET (nargs, SCM_UNDEFINED);
|
||||
}
|
||||
|
||||
RESET_FRAME (dst + 1);
|
||||
}
|
||||
|
||||
LOCAL_SET (dst, rest);
|
||||
|
||||
RESET_FRAME (dst + 1);
|
||||
|
||||
NEXT (1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue