PADRANGE: don't assume targs are contiguous
authorDavid Mitchell <davem@iabyn.com>
Mon, 12 Nov 2012 10:36:55 +0000 (10:36 +0000)
committerDavid Mitchell <davem@iabyn.com>
Mon, 12 Nov 2012 10:36:55 +0000 (10:36 +0000)
Normally in something like my($x,$y,$z), the 3 targs are contiguous;
however eternal modules like Function::Parameters can break that
assumption, so don't assume it.

op.c

diff --git a/op.c b/op.c
index b4a845e..8fab398 100644 (file)
--- a/op.c
+++ b/op.c
@@ -11020,10 +11020,11 @@ Perl_rpeep(pTHX_ register OP *o)
                 else {
                     if ((p->op_private & OPpLVAL_INTRO) != intro)
                         break;
-                    /* we expect targs to be contiguous in my($a,$b,$c)
-                     * but not in ($a, $x, $z). In the latter case, stop
-                     * on the first non-contiguous padop */
-                    if (!intro && p->op_targ != base + count)
+                    /* Note that you'd normally  expect targs to be
+                     * contiguous in my($a,$b,$c), but that's not the case
+                     * when external modules start doing things, e.g.
+                     i* Function::Parameters */
+                    if (p->op_targ != base + count)
                         break;
                     assert(p->op_targ == base + count);
                     /* all the padops should be in the same context */