summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-12-21 13:32:13 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:18:36 +0000
commit28e0cf42294edeeb3acfd68afd6695f1f8a09632 (patch)
treecea982793e857cc8ea6524e65034db43fed66d3b /cop.h
parent6fb05a88b585ff8c2ecf0a3f089acceca1bae5b7 (diff)
downloadperl-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.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cop.h b/cop.h
index ef86f4f2f4..ceb19ef440 100644
--- a/cop.h
+++ b/cop.h
@@ -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 */