summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2009-12-08 12:42:58 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2009-12-08 16:12:31 +0100
commitf6435df36c4167f97876032948ee21a446b75f27 (patch)
tree4a11f4276858e1f9734e2e7d6ed7f1c624f1c654 /op.c
parent13290fcd82823e130109fca5199c99fb886e29eb (diff)
downloadperl-f6435df36c4167f97876032948ee21a446b75f27.tar.gz
proper error on "grep $x (1,2,3)". Solves [perl #37314]
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/op.c b/op.c
index 5cbf917436..bc8403a312 100644
--- a/op.c
+++ b/op.c
@@ -7210,10 +7210,10 @@ Perl_ck_grep(pTHX_ OP *o)
if (o->op_flags & OPf_STACKED) {
OP* k;
o = ck_sort(o);
- kid = cLISTOPo->op_first->op_sibling;
- if (!cUNOPx(kid)->op_next)
- Perl_croak(aTHX_ "panic: ck_grep");
- for (k = cUNOPx(kid)->op_first; k; k = k->op_next) {
+ kid = cUNOPx(cLISTOPo->op_first->op_sibling)->op_first;
+ if (kid->op_type != OP_SCOPE && kid->op_type != OP_LEAVE)
+ return no_fh_allowed(o);
+ for (k = kid; k; k = k->op_next) {
kid = k;
}
NewOp(1101, gwop, 1, LOGOP);