This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
arybase.xs: Always check the op type in ck_*
authorFather Chrysostomos <sprout@cpan.org>
Thu, 27 Oct 2011 01:02:58 +0000 (18:02 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 27 Oct 2011 03:16:57 +0000 (20:16 -0700)
Sometimes the previous check function will have replaced the op
with one of a different type.  In that case, the rest of arybase’s
check function does not apply and can even cause a crash for ops
with no children (e.g., $x=wait is optimised down to a simple wait
op with no children and with op_targ pointing to $x, if it is
lexical).

ext/arybase/arybase.xs

index a2806dd..5c653e3 100644 (file)
@@ -166,23 +166,23 @@ STATIC void ab_process_assignment(pTHX_ OP *left, OP *right) {
 
 STATIC OP *ab_ck_sassign(pTHX_ OP *o) {
  o = (*ab_old_ck_sassign)(aTHX_ o);
- {
if (o->op_type == OP_SASSIGN) {
   OP *right = cBINOPx(o)->op_first;
   OP *left = right->op_sibling;
   if (left) ab_process_assignment(left, right);
-  return o;
  }
+ return o;
 }
 
 STATIC OP *ab_ck_aassign(pTHX_ OP *o) {
  o = (*ab_old_ck_aassign)(aTHX_ o);
- {
if (o->op_type == OP_AASSIGN) {
   OP *right = cBINOPx(o)->op_first;
   OP *left = cBINOPx(right->op_sibling)->op_first->op_sibling;
   right = cBINOPx(right)->op_first->op_sibling;
   ab_process_assignment(left, right);
-  return o;
  }
+ return o;
 }
 
 void