diff options
author | Father Chrysostomos <sprout@cpan.org> | 2016-06-10 08:54:56 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2016-06-11 06:17:01 -0700 |
commit | 1a3e97240d9aa40adfeecbebce3f3cce94fe131b (patch) | |
tree | 2ec695ac551d219a4794e542fc36de1cf1fb80c5 /op.c | |
parent | e4fc70828d25802f8f511e75d50813489648c124 (diff) | |
download | perl-1a3e97240d9aa40adfeecbebce3f3cce94fe131b.tar.gz |
op.c: Factor out common code for potential lv cx
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -2782,6 +2782,14 @@ S_lvref(pTHX_ OP *o, I32 type) o->op_private |= OPpLVREF_ITER; } +PERL_STATIC_INLINE bool +S_potential_mod_type(I32 type) +{ + /* Types that only potentially result in modification. */ + return type == OP_GREPSTART || type == OP_ENTERSUB + || type == OP_REFGEN || type == OP_LEAVESUBLV; +} + OP * Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) { @@ -2822,9 +2830,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) else { /* lvalue subroutine call */ o->op_private |= OPpLVAL_INTRO; PL_modcount = RETURN_UNLIMITED_NUMBER; - if (type == OP_GREPSTART || type == OP_ENTERSUB - || type == OP_REFGEN || type == OP_LEAVESUBLV) { - /* Potential lvalue context: */ + if (S_potential_mod_type(type)) { o->op_private |= OPpENTERSUB_INARGS; break; } @@ -2886,8 +2892,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) nomod: if (flags & OP_LVALUE_NO_CROAK) return NULL; /* grep, foreach, subcalls, refgen */ - if (type == OP_GREPSTART || type == OP_ENTERSUB - || type == OP_REFGEN || type == OP_LEAVESUBLV) + if (S_potential_mod_type(type)) break; yyerror(Perl_form(aTHX_ "Can't modify %s in %s", (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL) |