X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/1e1d4b91957a9f66bbb14b2c7f1bbf88c1f89cdf..84bafc024a74c819ac3d2b4406253dbe983e6502:/op.c diff --git a/op.c b/op.c index c16c111..42f997d 100644 --- a/op.c +++ b/op.c @@ -3532,7 +3532,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg) if (curop == repl && !(repl_has_vars && (!PM_GETRE(pm) - || PM_GETRE(pm)->extflags & RXf_EVAL_SEEN))) + || RX_EXTFLAGS(PM_GETRE(pm)) & RXf_EVAL_SEEN))) { pm->op_pmflags |= PMf_CONST; /* const for long enough */ prepend_elem(o->op_type, scalar(repl), o); @@ -7243,7 +7243,7 @@ Perl_ck_require(pTHX_ OP *o) for (; s < end; s++) { if (*s == ':' && s[1] == ':') { *s = '/'; - Move(s+2, s+1, end - s, char); + Move(s+2, s+1, end - s - 1, char); --end; } } @@ -7558,8 +7558,8 @@ Perl_ck_join(pTHX_ OP *o) if (kid && kid->op_type == OP_MATCH) { if (ckWARN(WARN_SYNTAX)) { const REGEXP *re = PM_GETRE(kPMOP); - const char *pmstr = re ? re->precomp : "STRING"; - const STRLEN len = re ? re->prelen : 6; + const char *pmstr = re ? RX_PRECOMP(re) : "STRING"; + const STRLEN len = re ? RX_PRELEN(re) : 6; Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "/%.*s/ should probably be written as \"%.*s\"", (int)len, pmstr, (int)len, pmstr); @@ -7892,6 +7892,27 @@ Perl_ck_substr(pTHX_ OP *o) return o; } +OP * +Perl_ck_each(pTHX_ OP *o) +{ + + OP *kid = cLISTOPo->op_first; + + if (kid->op_type == OP_PADAV || kid->op_type == OP_RV2AV) { + const unsigned new_type = o->op_type == OP_EACH ? OP_AEACH + : o->op_type == OP_KEYS ? OP_AKEYS : OP_AVALUES; + o->op_type = new_type; + o->op_ppaddr = PL_ppaddr[new_type]; + } + else if (!(kid->op_type == OP_PADHV || kid->op_type == OP_RV2HV + || (kid->op_type == OP_CONST && kid->op_private & OPpCONST_BARE) + )) { + bad_type(1, "hash or array", PL_op_desc[o->op_type], kid); + return o; + } + return ck_fun(o); +} + /* A peephole optimizer. We visit the ops in the order they're to execute. * See the comments at the top of this file for more details about when * peep() is called */ @@ -8451,7 +8472,7 @@ Perl_peep(pTHX_ register OP *o) UNOP *refgen, *rv2cv; LISTOP *exlist; - if ((o->op_flags && OPf_WANT) != OPf_WANT_VOID) + if ((o->op_flags & OPf_WANT) != OPf_WANT_VOID) break; if ((o->op_private & ~OPpASSIGN_BACKWARDS) != 2)