From: Vincent Pit Date: Sat, 20 Sep 2014 15:59:52 +0000 (+0200) Subject: Add support for PERL_OP_PARENT X-Git-Tag: v0.25~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=83fcc5faed4fc157a242911f96a5c97095dd2899;p=perl%2Fmodules%2FScope-Upper.git Add support for PERL_OP_PARENT This was introduced in perl 5.21.2. --- diff --git a/Upper.xs b/Upper.xs index eb45c1f..497b70e 100644 --- a/Upper.xs +++ b/Upper.xs @@ -197,6 +197,10 @@ STATIC U8 su_op_gimme_reverse(U8 gimme) { #define OP_GIMME_REVERSE(G) su_op_gimme_reverse(G) #endif +#ifndef OP_SIBLING +# define OP_SIBLING(O) ((O)->op_sibling) +#endif + #ifndef PERL_MAGIC_tied # define PERL_MAGIC_tied 'P' #endif @@ -1401,7 +1405,7 @@ STATIC void su_uplevel_storage_delete(pTHX_ su_uplevel_ud *sud) { } STATIC int su_uplevel_goto_static(const OP *o) { - for (; o; o = o->op_sibling) { + for (; o; o = OP_SIBLING(o)) { /* goto ops are unops with kids. */ if (!(o->op_flags & OPf_KIDS)) continue; @@ -2093,8 +2097,8 @@ STATIC I32 su_context_normalize_up(pTHX_ I32 cxix) { return cxix - 1; break; case CXt_SUBST: - if (cx->blk_oldcop && cx->blk_oldcop->op_sibling - && cx->blk_oldcop->op_sibling->op_type == OP_SUBST) + if (cx->blk_oldcop && OP_SIBLING(cx->blk_oldcop) + && OP_SIBLING(cx->blk_oldcop)->op_type == OP_SUBST) return cxix - 1; break; } @@ -2129,8 +2133,8 @@ STATIC I32 su_context_normalize_down(pTHX_ I32 cxix) { return cxix + 1; break; case CXt_SUBST: - if (next->blk_oldcop && next->blk_oldcop->op_sibling - && next->blk_oldcop->op_sibling->op_type == OP_SUBST) + if (next->blk_oldcop && OP_SIBLING(next->blk_oldcop) + && OP_SIBLING(next->blk_oldcop)->op_type == OP_SUBST) return cxix + 1; break; } @@ -2160,8 +2164,8 @@ STATIC I32 su_context_gimme(pTHX_ I32 cxix) { #endif case CXt_SUBST: { const COP *cop = cx->blk_oldcop; - if (cop && cop->op_sibling) { - switch (cop->op_sibling->op_flags & OPf_WANT) { + if (cop && OP_SIBLING(cop)) { + switch (OP_SIBLING(cop)->op_flags & OPf_WANT) { case OPf_WANT_VOID: return G_VOID; case OPf_WANT_SCALAR: