use a flag to signal a stacking filetests instead of peeking at the next op.
authorGerard Goossen <gerard@ggoossen.net>
Mon, 17 Jan 2011 21:12:53 +0000 (22:12 +0100)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 11 Jul 2011 20:13:55 +0000 (13:13 -0700)
Preparation for the codegeneration changes where the next op isn't accessible.

op.c
op.h
pp_sys.c

diff --git a/op.c b/op.c
index fba667f..47ca0b2 100644 (file)
--- a/op.c
+++ b/op.c
@@ -7342,8 +7342,10 @@ Perl_ck_ftst(pTHX_ OP *o)
        if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o->op_type))
            o->op_private |= OPpFT_ACCESS;
        if (PL_check[kidtype] == Perl_ck_ftst
-               && kidtype != OP_STAT && kidtype != OP_LSTAT)
+               && kidtype != OP_STAT && kidtype != OP_LSTAT) {
            o->op_private |= OPpFT_STACKED;
+           kid->op_private |= OPpFT_STACKING;
+       }
     }
     else {
 #ifdef PERL_MAD
diff --git a/op.h b/op.h
index e184468..cbcac7d 100644 (file)
--- a/op.h
+++ b/op.h
@@ -284,7 +284,8 @@ Deprecated.  Use C<GIMME_V> instead.
 
 /* Private for OP_FTXXX */
 #define OPpFT_ACCESS           2       /* use filetest 'access' */
-#define OPpFT_STACKED          4       /* stacked filetest, as in "-f -x $f" */
+#define OPpFT_STACKED          4       /* stacked filetest, as "-f" in "-f -x $f" */
+#define OPpFT_STACKING         8       /* stacking filetest, as "-x" in "-f -x $f" */
 
 /* Private for OP_(MAP|GREP)(WHILE|START) */
 #define OPpGREP_LEX            2       /* iterate over lexical $_ */
index 6ef266f..3325453 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2914,11 +2914,7 @@ S_try_amagic_ftest(pTHX_ char chr) {
 
        SPAGAIN;
 
-       next = PL_op->op_next;
-       if (next->op_type >= OP_FTRREAD &&
-           next->op_type <= OP_FTBINARY &&
-           next->op_private & OPpFT_STACKED
-       ) {
+       if (PL_op->op_private & OPpFT_STACKING) {
            if (SvTRUE(tmpsv))
                /* leave the object alone */
                return TRUE;