diff options
author | David Mitchell <davem@iabyn.com> | 2015-12-21 13:32:13 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 09:18:36 +0000 |
commit | 28e0cf42294edeeb3acfd68afd6695f1f8a09632 (patch) | |
tree | cea982793e857cc8ea6524e65034db43fed66d3b /cop.h | |
parent | 6fb05a88b585ff8c2ecf0a3f089acceca1bae5b7 (diff) | |
download | perl-28e0cf42294edeeb3acfd68afd6695f1f8a09632.tar.gz |
only set CXp_FOR_DEF with CXp_FOR_GV
C<for (...)> is a special-case of C<for $pkg_var (...)>, so CXp_FOR_DEF
should only be set when CXp_FOR_GV also is. So in pp_enteriter(), only
test for (PL_op->op_private & OPpITER_DEF) in the GV branch and assert
that it's otherwise unset. This is slightly more efficient in the non-GV
branches.
Also add some more commentary to the CXp_FOR_* flag definitions.
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1087,10 +1087,14 @@ struct context { #define CXp_TRYBLOCK 0x40 /* eval{}, not eval'' or similar */ /* private flags for CXt_LOOP */ + +/* this is only set in conjunction with CXp_FOR_GV */ #define CXp_FOR_DEF 0x10 /* foreach using $_ */ +/* these 3 are mutually exclusive */ #define CXp_FOR_LVREF 0x20 /* foreach using \$var */ #define CXp_FOR_GV 0x40 /* foreach using package var */ #define CXp_FOR_PAD 0x80 /* foreach using lexical var */ + #define CxPADLOOP(c) ((c)->cx_type & CXp_FOR_PAD) /* private flags for CXt_SUBST */ |