# New Ticket Created by Bob Rogers
# Please include the string: [perl #38294]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38294 >
From: Leopold Toetsch <[EMAIL PROTECTED]>
Date: Sat, 21 Jan 2006 01:40:38 +0100
As mentioned earlier today, I've rewritten the guts of the argument
passing code. It's now one function 'process_args', which is mostly a
state machine with currently ~12 cases that handles the various states
or should eventually handle . . .
leo
The state transition from :optional to :slurpy results in an "Unhandled
process_args state 0x83" error. The attached fix works, though it may
not be complete. Also, it assumes that CALL_STATE_SLURP and
CALL_STATE_OPT are mutually exclusive; seems to me they ought to be, but
I may not have read your spec carefully enough.
-- Bob Rogers
http://rgrjr.dyndns.org/
Index: src/inter_call.c
===================================================================
--- src/inter_call.c (revision 11276)
+++ src/inter_call.c (working copy)
@@ -728,6 +728,7 @@
enum_class_ResizablePMCArray));
CTX_REG_PMC(st->dest.ctx, idx) = st->dest.slurp;
st->dest.mode |= CALL_STATE_SLURP;
+ st->dest.mode &= ~CALL_STATE_OPT;
}
static void
@@ -916,8 +917,9 @@
break;
default:
- internal_exception(1, "Unhandled process_args state 0x%x",
- state);
+ real_exception(interpreter, NULL, 0,
+ "Unhandled process_args state 0x%x",
+ state);
}
} while (1);
}
Index: t/op/calling.t
===================================================================
--- t/op/calling.t (revision 11276)
+++ t/op/calling.t (working copy)
@@ -1714,6 +1714,38 @@
ok
OUTPUT
+pir_output_is(<<'CODE', <<'OUTPUT', ":optional followed by :slurpy (empty)");
+.sub main :main
+ _write_thing(3)
+.end
+.sub _write_thing
+ .param pmc arg1 :optional
+ .param pmc rest_arg :slurpy
+ print arg1
+ print ' '
+ print rest_arg
+ print "\n"
+.end
+CODE
+3 0
+OUTPUT
+
+pir_output_is(<<'CODE', <<'OUTPUT', ":optional followed by :slurpy (used)");
+.sub main :main
+ _write_thing(3, 4, 5)
+.end
+.sub _write_thing
+ .param pmc arg1 :optional
+ .param pmc rest_arg :slurpy
+ print arg1
+ print ' '
+ print rest_arg
+ print "\n"
+.end
+CODE
+3 2
+OUTPUT
+
## remember to change the number of tests :-)
-BEGIN { plan tests => 64; }
+BEGIN { plan tests => 66; }