summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-01-23 02:32:31 +0000
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-04 14:09:11 +0000
commit99dbf64538ee1c097b9f7e93df5a45dbf1fa3e22 (patch)
treebf7b524ce01afd970144e9e66d25bd878633d2c5
parentbe319be3519a71b4f83463937d76d7e2ce14e7fe (diff)
downloadperl-99dbf64538ee1c097b9f7e93df5a45dbf1fa3e22.tar.gz
Rename CxTRYBLOCK() to CxEVALBLOCK()
CxTRYBLOCK would be confusing when we add a real CxTRY for try/catch Also renames the associated CXp_TRYBLOCK flag to CXp_EVALBLOCK
-rw-r--r--cop.h10
-rw-r--r--dump.c2
-rw-r--r--pp_ctl.c8
3 files changed, 12 insertions, 8 deletions
diff --git a/cop.h b/cop.h
index a1f5b921bb..7a7e831c6a 100644
--- a/cop.h
+++ b/cop.h
@@ -953,7 +953,7 @@ struct context {
/* private flags for CXt_EVAL */
#define CXp_REAL 0x20 /* truly eval'', not a lookalike */
-#define CXp_TRYBLOCK 0x40 /* eval{}, not eval'' or similar */
+#define CXp_EVALBLOCK 0x40 /* eval{}, not eval'' or similar */
/* private flags for CXt_LOOP */
@@ -975,11 +975,15 @@ struct context {
#define CxMULTICALL(c) ((c)->cx_type & CXp_MULTICALL)
#define CxREALEVAL(c) (((c)->cx_type & (CXTYPEMASK|CXp_REAL)) \
== (CXt_EVAL|CXp_REAL))
-#define CxTRYBLOCK(c) (((c)->cx_type & (CXTYPEMASK|CXp_TRYBLOCK)) \
- == (CXt_EVAL|CXp_TRYBLOCK))
+#define CxEVALBLOCK(c) (((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK)) \
+ == (CXt_EVAL|CXp_EVALBLOCK))
#define CxFOREACH(c) ( CxTYPE(cx) >= CXt_LOOP_ARY \
&& CxTYPE(cx) <= CXt_LOOP_LIST)
+/* deprecated old name before real try/catch was added */
+#define CXp_TRYBLOCK CXp_EVALBLOCK
+#define CxTRYBLOCK(c) CxEVALBLOCK(c)
+
#define CXINC (cxstack_ix < cxstack_max ? ++cxstack_ix : (cxstack_ix = cxinc()))
#define G_SCALAR 2
diff --git a/dump.c b/dump.c
index 21dd53a65a..bb5f533543 100644
--- a/dump.c
+++ b/dump.c
@@ -3067,7 +3067,7 @@ S_deb_curcv(pTHX_ I32 ix)
if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT)
return cx->blk_sub.cv;
- else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
+ else if (CxTYPE(cx) == CXt_EVAL && !CxEVALBLOCK(cx))
return cx->blk_eval.cv;
else if (ix == 0 && si->si_type == PERLSI_MAIN)
return PL_main_cv;
diff --git a/pp_ctl.c b/pp_ctl.c
index 654ecca270..11c015e0df 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2563,7 +2563,7 @@ PP(pp_return)
/* fall through to a normal exit */
switch (CxTYPE(cx)) {
case CXt_EVAL:
- return CxTRYBLOCK(cx)
+ return CxEVALBLOCK(cx)
? Perl_pp_leavetry(aTHX)
: Perl_pp_leaveeval(aTHX);
case CXt_SUB:
@@ -3064,7 +3064,7 @@ PP(pp_goto)
switch (CxTYPE(cx)) {
case CXt_EVAL:
leaving_eval = TRUE;
- if (!CxTRYBLOCK(cx)) {
+ if (!CxEVALBLOCK(cx)) {
gotoprobe = (last_eval_cx ?
last_eval_cx->blk_eval.old_eval_root :
PL_eval_root);
@@ -3348,7 +3348,7 @@ Perl_find_runcv_where(pTHX_ U8 cond, IV arg, U32 *db_seqp)
if (cx->cx_type & CXp_SUB_RE)
continue;
}
- else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx))
+ else if (CxTYPE(cx) == CXt_EVAL && !CxEVALBLOCK(cx))
cv = cx->blk_eval.cv;
if (cv) {
switch (cond) {
@@ -4615,7 +4615,7 @@ Perl_create_eval_scope(pTHX_ OP *retop, U32 flags)
PERL_CONTEXT *cx;
const U8 gimme = GIMME_V;
- cx = cx_pushblock((CXt_EVAL|CXp_TRYBLOCK), gimme,
+ cx = cx_pushblock((CXt_EVAL|CXp_EVALBLOCK), gimme,
PL_stack_sp, PL_savestack_ix);
cx_pusheval(cx, retop, NULL);