The first named parameter isn't set if optional parameters are missing. The
function Parrot_process_args didn't
save the value of the argument. I used memcpy to copy the UnionVal. If there's
a neater way to do that please
fix my fix :) .
It only adds a couple of lines to src/inter_call.c. Here's the diffstat output:
CREDITS | 4 ++++
src/inter_call.c | 4 ++++
2 files changed, 8 insertions(+)
Index: src/inter_call.c
===================================================================
--- src/inter_call.c (revision 30275)
+++ src/inter_call.c (working copy)
@@ -1310,6 +1310,8 @@
/* if the src arg is named, we're done here */
if (st->name) {
/* but first, take care of any :optional arguments */
+ UnionVal old_value; /* value of the argument */
+ memcpy (&old_value, &st->val, sizeof(UnionVal));
while (dest->sig & PARROT_ARG_OPTIONAL) {
null_val(st->dest.sig, st);
@@ -1324,6 +1326,8 @@
dest->i++;
next_arg_sig(dest);
}
+ /* Restore the value */
+ memcpy (&st->val, &old_value, sizeof(UnionVal));
break;
}
Index: CREDITS
===================================================================
--- CREDITS (revision 30275)
+++ CREDITS (working copy)
@@ -716,3 +716,7 @@
N: Zach Morgan
E: [EMAIL PROTECTED]
D: Rakudo patch
+
+N: Marcelo Serra Castilhos
+E: [EMAIL PROTECTED]
+D: Bug fix