]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Better logic for finding oo and om in ck_entersub
authorVincent Pit <vince@profvince.com>
Thu, 28 Aug 2008 14:28:15 +0000 (16:28 +0200)
committerVincent Pit <vince@profvince.com>
Thu, 28 Aug 2008 14:28:15 +0000 (16:28 +0200)
indirect.xs

index 2d02563f3fe1f437801d0a3887a699a2d05ee3ab..aa2e69198efcc9caf25dabb40ad9f88ef969a3d2 100644 (file)
@@ -192,13 +192,15 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
  if (hint) {
   const char *pm, *po;
   SV *svm, *svo;
-  op = (LISTOP *) o;
-  while (op->op_type != OP_PUSHMARK)
-   op = (LISTOP *) op->op_first;
-  oo = op->op_sibling;
-  om = oo;
-  while (om->op_sibling)
-   om = om->op_sibling;
+  oo = o;
+  do {
+   op = (LISTOP *) oo;
+   if (!op->op_flags & OPf_KIDS)
+    goto done;
+   oo = op->op_first;
+  } while (oo->op_type != OP_PUSHMARK);
+  oo = oo->op_sibling;
+  om = op->op_last;
   if (om->op_type == OP_METHOD)
    om = cUNOPx(om)->op_first;
   else if (om->op_type != OP_METHOD_NAMED)