diff options
author | David Leadbeater <dgl@dgl.cx> | 2010-08-28 22:39:58 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-09-07 16:02:59 +0200 |
commit | 329a333e7a4ed898282bec7f485751efbea92e8f (patch) | |
tree | 58488cbb987c73db35605786b2cac53b495f4e60 /op.c | |
parent | 90d1f214e03568148fd6495efac0f5614cfc0323 (diff) | |
download | perl-329a333e7a4ed898282bec7f485751efbea92e8f.tar.gz |
Fix RT #77468: Smart matching on slices
ref_array_or_hash did not take aslice or hslice OPs into account; wrap
them in an anonlist so that smart matching has a reference as it
expects.
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -5542,6 +5542,18 @@ S_ref_array_or_hash(pTHX_ OP *cond) return newUNOP(OP_REFGEN, 0, mod(cond, OP_REFGEN)); + else if(cond + && (cond->op_type == OP_ASLICE + || cond->op_type == OP_HSLICE)) { + + /* anonlist now needs a list from this op, was previously used in + * scalar context */ + cond->op_flags |= ~(OPf_WANT_SCALAR | OPf_REF); + cond->op_flags |= OPf_WANT_LIST; + + return newANONLIST(mod(cond, OP_ANONLIST)); + } + else return cond; } |