Skip to content

Commit

Permalink
use a flag to signal a stacking filetests instead of peeking at the n…
Browse files Browse the repository at this point in the history
…ext op.

Preparation for the codegeneration changes where the next op isn't accessible.
  • Loading branch information
ggoossen authored and Father Chrysostomos committed Jul 11, 2011
1 parent b852bf2 commit bbd9130
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion op.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion op.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 $_ */
Expand Down
6 changes: 1 addition & 5 deletions pp_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bbd9130

Please sign in to comment.